/*****************************************************************************
*  Copyright Statement:
*  --------------------
*  This software is protected by Copyright and the information contained
*  herein is confidential. The software may not be copied and the information
*  contained herein may not be used or disclosed except with the written
*  permission of MediaTek Inc. (C) 2005
*
*  BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
*  THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
*  RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
*  AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
*  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
*  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
*  NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
*  SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
*  SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
*  THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
*  NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
*  SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
*
*  BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
*  LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
*  AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
*  OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
*  MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. 
*
*  THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
*  WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
*  LAWS PRINCIPLES.  ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
*  RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
*  THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
*
*****************************************************************************/

/*****************************************************************************
 *
 * Filename:
 * ---------
 *   wgui_categories_inputs.c
 *
 * Project:
 * --------
 *   Maui_Software
 *
 * Description:
 * ------------
 * Input/Editor related categoreis.
 *
 * Author:
 * -------
 * -------
 *
 *============================================================================
 *             HISTORY
 * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
 *------------------------------------------------------------------------------
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 *------------------------------------------------------------------------------
 * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
 *============================================================================
 ****************************************************************************/

/***************************************************************************** 
 * Include 
 *****************************************************************************/
#include "MMI_features.h"
#include "stdC.h"
#include "mmi_platform.h"
#include "mmi_frm_gprot.h"
#include "GlobalDefs.h"
#include "WguiCategoryGprot.h"
#include "bididef.h"
#include "IMERes.h"

#ifdef __MMI_INDIC_ALG__
#include "IndicEngineGprot.h"
#endif 

#if defined(__MMI_SMART_MESSAGE_MO__) && !defined(__MMI_MESSAGES_EMS__)
#include "SmsGuiInterfaceType.h"
#include "MessagesResourceData.h"
#endif /* defined(__MMI_SMART_MESSAGE_MO__) && !defined(__MMI_MESSAGES_EMS__) */ 

#include "IMERes.h"
#include "wgui_ems.h"
#include "app_str.h"

#ifdef __MMI_DUAL_SIM_MASTER__
#include "MTPNP_PFAL_CC.h"
#endif  /* __MMI_DUAL_SIM_MASTER__ */


#ifdef __MMI_TOUCH_SCREEN__
#include "wgui_virtual_keyboard.h"
#endif
#include "wgui_dynamic_menus.h"
#include "gui_dynamic_menus.h"

#include "BIDIDEF.h"
#include "BIDIProt.h"

/***************************************************************************** 
 * Global Variable
 *****************************************************************************/
mmi_editor_handler_struct g_mmi_editor_hanler;

#ifdef UI_SMALL_CATEGORY_EDITOR
BOOL g_small_editor_category_present = FALSE;
extern U16 title_bg_id;
#endif 

U8 cat_215_text_length;

#if defined(__MMI_WCSS_INPUT_FORMAT_SUPPORT__)
MMI_BOOL is_fisrt_entry_WCSS_editor = TRUE;
#endif 

#if defined (__MMI_BIDI_ALG__)
extern U8 MMI_bidi_input_type;
#endif 

#if defined (__MMI_WALLPAPER_ON_BOTTOM__)
static U8 editor_scr_bg_opacity;
#endif /* defined (__MMI_WALLPAPER_ON_BOTTOM__) */ 

#ifdef __MMI_INDIC_ALG__
U32 add_template_ems_flag=0;
#endif /* __MMI_INDIC_ALG__ */

#if defined(__MMI_PREFER_WRITING_LANG__) || defined(__MMI_MIXED_LANG_SUPPORT__)
S16 g_ime_main_writing_lang = IME_WRITING_LANG_ABC;
#endif /* defined(__MMI_PREFER_WRITING_LANG__) || defined(__MMI_MIXED_LANG_SUPPORT__) */

#if defined(__MMI_MIXED_LANG_SUPPORT__)
S16 g_ime_sub_writing_lang = IME_WRITING_LANG_NONE;
#endif /* defined(__MMI_MIXED_LANG_SUPPORT__) */

pBOOL(*wgui_e_dictionary_test_clear_inputbox_buffer) (void) = NULL;

BOOL(*wgui_check_editor_buffer_need_flush) (void) = NULL;

/* global variable of category35 multiline box */
multi_line_input_box cat35_message_box;

void (*category28_RSK_function) (void) = NULL;
U8 category28_RSK_label_clear = 0;
UI_string_type category28_RSK_label_string;
PU8 category28_RSK_label_icon;

/* EMS category */
extern UI_EMS_input_box MMI_EMS_inputbox;
extern U8 EMS_inputbox_has_changed;
extern PU8 wgui_EMS_inputbox_information_icon;
extern EMSTextFormat wgui_EMS_text_format;
extern S32 wgui_EMS_inputbox_information_bar_height;
extern U8 EMS_inputbox_alignment_added_flag;
extern EMSALIGNMENT EMS_inputbox_alignment;

#if((UI_ENABLE_FRAME_SKIPPING) && (ENABLE_EMS_INPUTBOX_FRAME_SKIPPING))
extern S32 wgui_EMS_inputbox_frame_counter;
#endif 
extern void (*EMS_inputbox_input_callback) (void);

/***************************************************************************** 
 * Global Function
 *****************************************************************************/
extern void setup_scrolling_title(void);
extern void close_scrolling_title(void);
extern void register_EMS_inputbox_input_callback(void (*f) (void));
extern void SetInputMethod(U16 index);
extern S32 gui_EMS_input_box_highlight_cursor_number(UI_EMS_input_box *b, S32 numOfChar);
extern void MoveCursorToPosition(EMSData *data, EMSPosition *dst);

#ifdef MBM_IMIBASE_SUPPORT
extern U16 mbm_get_system_current_input_type(void);
extern BOOL mbm_is_input_screen(void);
extern PS8 mbm_get_system_current_input_title(void);
#endif //MBM_IMIBASE_SUPPORT

/*****************************************************************************
 * FUNCTION
 *  wgui_set_e_dictionary_test_clear_inputbox_buffer_funcptr
 * DESCRIPTION
 *  A function pointer which tests if need to clear
 *  multi-line inputbox buffer
 * PARAMETERS
 *  FuncPtr     [IN]        
 * RETURNS
 *  void
 *****************************************************************************/
void wgui_set_e_dictionary_test_clear_inputbox_buffer_funcptr(pBOOL(*FuncPtr) (void))
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    wgui_e_dictionary_test_clear_inputbox_buffer = FuncPtr;
}


/*****************************************************************************
 * FUNCTION
 *  wgui_reset_e_dictionary_test_clear_inputbox_buffer_funcptr
 * DESCRIPTION
 *  
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void wgui_reset_e_dictionary_test_clear_inputbox_buffer_funcptr(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    wgui_e_dictionary_test_clear_inputbox_buffer = NULL;
}


/*****************************************************************************
 * FUNCTION
 *  RedrawCategory5Screen
 * DESCRIPTION
 *  Redraws the category5 screen
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void RedrawCategory5Screen(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    gui_lock_double_buffer();

    clear_screen();
    show_title_status_icon();
    draw_title();
    wgui_inputs_ml_show_with_information_bar();
    show_softkey_background();
    show_left_softkey();
    show_right_softkey();
    gui_unlock_double_buffer();
    gui_BLT_double_buffer(0, 0, UI_device_width - 1, UI_device_height - 1);
    /* for redrawing spelling or candidate boxes */
    if (RedrawSpellingOrCandidateBoxesFunction)
    {
        RedrawSpellingOrCandidateBoxesFunction();
    }
}


/*****************************************************************************
 * FUNCTION
 *  category5callback
 * DESCRIPTION
 *  
 * PARAMETERS
 *  coordinate      [?]     
 * RETURNS
 *  void
 *****************************************************************************/
void category5callback(dm_coordinates *coordinate)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* for redrawing spelling or candidate boxes */
    if (RedrawSpellingOrCandidateBoxesFunction)
    {
        RedrawSpellingOrCandidateBoxesFunction();
    }
}


/*****************************************************************************
 * FUNCTION
 *  SetCategory5RightSoftkeyFunction
 * DESCRIPTION
 *  
 * PARAMETERS
 *  f       [IN]        
 *  k       [IN]        
 * RETURNS
 *  void
 *****************************************************************************/
void SetCategory5RightSoftkeyFunction(void (*f) (void), MMI_key_event_type k)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    UI_UNUSED_PARAMETER(k);
    wgui_inputbox_RSK_function = f;
}


/*****************************************************************************
 * FUNCTION
 *  AppendCategory5String
 * DESCRIPTION
 *  Function to append a string to category 5 screen
 * PARAMETERS
 *  f       [IN]        
 *  k       [IN]        
 * RETURNS
 *  void
 *****************************************************************************/
void AppendCategory5String(U32 input_type, U8 *buffer, S32 buffer_size, U8 *s, U8 *history_buffer)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    wgui_inputs_ml_append_string(input_type,buffer,buffer_size,s,history_buffer,MMI_CATEGORY5_ID,NULL);
}


/* For detail description, please refer to wgui_categories_inputs.h */
void ShowCategory5Screen(
        U16 title,
        U16 title_icon,
        U16 left_softkey,
        U16 left_softkey_icon,
        U16 right_softkey,
        U16 right_softkey_icon,
        U32 input_type,
        U8 *buffer,
        S32 buffer_size,
        U8 *history_buffer)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* Begin AP input mode set */
    ShowCategory5Screen_ext(
        title,
        title_icon,
        left_softkey,
        left_softkey_icon,
        right_softkey,
        right_softkey_icon,
        input_type,
        buffer,
        buffer_size,
        history_buffer,
        0,
        NULL);
    /* End AP input mode set */
}


/*****************************************************************************
 * FUNCTION
 *  Register_cat5_editor_buffer_need_flush
 * DESCRIPTION
 *  
 * PARAMETERS
 *  FuncPtr     [IN]        
 * RETURNS
 *  void
 *****************************************************************************/
void Register_cat5_editor_buffer_need_flush(BOOL(*FuncPtr) (void))      /* rajbir */
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    wgui_check_editor_buffer_need_flush = FuncPtr;
}

static S32 g_title_in_header = 0;
static MMI_BOOL g_wgui_cat2002_is_active_editor = MMI_TRUE;
/*****************************************************************************
 * FUNCTION
 *  wgui_cat5_set_title_in_header
 * DESCRIPTION
 *  set title in header style 
 * PARAMETERS
 *  b_set     [IN]        
 * RETURNS
 *  void
 *****************************************************************************/
void wgui_cat5_set_title_in_header(S32 b_set)
{
#if !defined(GUI_EDITOR_SHOW_TITLE)
    g_title_in_header = b_set;
#endif
}

/*****************************************************************************
 * FUNCTION
 *  title_in_header_callback
 * DESCRIPTION
 *  redraw header 
 * PARAMETERS
 *  yoffset     [IN]        offset Y
 *  clip_x1     [IN]        start x
 *  clip_y1     [IN]        start y
 *  clip_x2     [IN]        end x
 *  clip_y2     [IN]        end y
 * RETURNS
 *  void
 *****************************************************************************/
void wgui_cat5_title_in_header_callback(MMI_BOOL is_draw, S32 yy, S32 height, S32 x1, S32 y1, S32 x2, S32 y2)
{
    S32 header_y2;

    if (!is_draw)
        return;
    
    header_y2 = yy + height - 1;
    
    gui_push_clip();
    gui_set_clip(x1, y1, x2, header_y2>y2 ? y2 : header_y2);

    wgui_title_create();
    wgui_title_move(x1, yy);
    wgui_title_resize(x2 - x1 + 1, MMI_title_height);
    wgui_title_set_style(GUI_TITLE_STYLE_LEFTALIGN);
    wgui_status_icon_integrated_enable(MMI_FALSE);
    wgui_title_set_no_icon_shct(MMI_FALSE);

    wgui_title_change(0, 0, (U8 *)MMI_title_string, WGUI_TITLE_CHANGE_ICON | WGUI_TITLE_CHANGE_ICON2 | WGUI_TITLE_CHANGE_TEXT);
    wgui_title_show(GUI_TITLE_PART_ALL);
    gui_pop_clip();
}

#if defined (__MMI_VIRTUAL_KEYBOARD__) && defined(__MMI_MAINLCD_320X240__) 
static U32 wgui_cat2002_ime_msg_callback(void * input_box_handle, mmi_imc_message_struct_p msg_ptr);
#endif /* (__MMI_VIRTUAL_KEYBOARD__) && (__MMI_MAINLCD_320X240__)  */
/*****************************************************************************
 * FUNCTION
 *  wgui_cat_ml_inputbox_show_internal
 * DESCRIPTION
 *  show the normal multiline inputbox category.
 * PARAMETERS
 * title :                   [IN] (TITLE) String ID of title.
 * title_icon :              [IN] (N/A) Image ID of title icon.
 * left_softkey :            [IN] (LSK) String ID of left softkey.
 * left_softkey_icon :       [IN] (N/A) Image ID of left softkey.
 * right_softkey :           [IN] (RSK) String ID of right softkey.
 * right_softkey_icon :      [IN] (N/A) Image ID of right softkey.
 * input_type :              [IN] (N/A) Allowable input type for this inputbox.
 *                                    Please refer to mmi_imm_input_type_enum(ImeGprot.h) for detail.
 * buffer :                  [IN] (N/A) Buffer for the input box.
 * buffer_size :             [IN] (N/A) Size of the buffer.
 * history_buffer :          [IN] (N/A) History buffer. 
 * input_ext_type :          [IN] (N/A) Special flags for application.  
 * required_input_mode_set : [IN] (N/A) The input mode list.  
 * RETURNS
 *  void
 *****************************************************************************/
static void wgui_cat_ml_inputbox_show_internal(
        UI_string_type title,
        PU8 title_icon,
        UI_string_type left_softkey,
        PU8 left_softkey_icon,
        UI_string_type right_softkey,
        PU8 right_softkey_icon,
        U8 *ticker_text,
        U32 input_type,
        U8 *buffer,
        S32 buffer_size,
        U8 *history_buffer,
        S16 input_ext_type,
        mmi_imm_input_mode_enum *required_input_mode_set,
        MMI_BOOL is_active_editor,
        MMI_BOOL force_title,
        S32 cat_id)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    dm_data_struct dm_data;
    S32 header_height = 0;
    S32 inputbox_x = 0;
    S32 inputbox_y = (MMI_title_y + MMI_title_height);
    S32 inputbox_width = MMI_content_width;

#if defined(__MMI_FULL_SCREEN_EDITOR__)
    S32 inputbox_height = MMI_content_height;
#else 
    S32 inputbox_height = MMI_content_height - MMI_multitap_height;
#endif 

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/  
#if(UI_DOUBLE_BUFFER_SUPPORT)
    gui_lock_double_buffer();
#endif 

    /* set the editor active flag */
    g_wgui_cat2002_is_active_editor = is_active_editor;

    wgui_title_set_menu_shortcut_number(-1);
    wgui_title_disable_menu_shortcut_display(MMI_TRUE);
    dm_add_title(title, title_icon); 
    dm_add_softkey(left_softkey, left_softkey_icon, right_softkey, right_softkey_icon);

    /* if ticker_text == NULL, we also need to add at here, because it may be add at run time */
    dm_add_scroll_text_ext(
        (UI_string_type) ticker_text, 
        MMI_COMMON_CONTENT_X,
        MMI_COMMON_CONTENT_Y,
        MMI_COMMON_CONTENT_WIDTH,
        MMI_SINGLELINE_INPUTBOX_HEIGHT,
        NULL,
        #ifdef __MMI_WALLPAPER_ON_BOTTOM__
        wgui_category_clear_region_with_transparent_color,
        #else
        NULL,
        #endif/* __MMI_WALLPAPER_ON_BOTTOM__ */
        *current_MMI_theme->list_normal_text_color,
        *current_MMI_theme->list_normal_text_color,
        MMI_TRUE);

    if (g_title_in_header)
    {
        header_height = MMI_title_height;
    }

#if defined (__MMI_VIRTUAL_KEYBOARD__) && defined(__MMI_MAINLCD_320X240__) 
    if((cat_id == MMI_CAT2002_ID) || (cat_id == MMI_CAT2002_NO_TICKER_ID))
    {
        wgui_inputs_ml_setup_ext2(
            inputbox_x,
            inputbox_y,
            inputbox_width,
            inputbox_height,
            buffer,
            buffer_size,
            cat_id,
            right_softkey,
            right_softkey_icon,
            input_type,
            history_buffer,
            required_input_mode_set,
            1,
            0,
            0,
            0,
            (S16)header_height,
            0,
            NULL,
            wgui_cat2002_ime_msg_callback);
    }
    else
#endif /* (__MMI_MAINLCD_320X240__) && (__MMI_VIRTUAL_KEYBOARD__) */
    {
        wgui_inputs_ml_setup_ext(
            inputbox_x,
            inputbox_y,
            inputbox_width,
            inputbox_height,
            buffer,
            buffer_size,
            cat_id,
            right_softkey,
            right_softkey_icon,
            input_type,
            history_buffer,
            required_input_mode_set,
            1,
            0,
            0,
            0,
            (S16)header_height,
            0,
            NULL);
    }
    
    wgui_inputs_ml_set_common_style(MMI_TRUE, MMI_TRUE);
    
    if (g_title_in_header)
    {
        MMI_multiline_inputbox.header_callback = wgui_cat5_title_in_header_callback;
    }
    
    /* if input method changed from "option", and language changed then delete all character in case of dictionary */
    if (wgui_check_editor_buffer_need_flush)
    {
        if (wgui_check_editor_buffer_need_flush())
        {
            wgui_inputs_ml_delete_all_characters();
            set_right_softkey_function(GoBackHistory, KEY_EVENT_UP);
        }
    }
    
    if (input_ext_type != 0)
    {
        MMI_current_input_ext_type = input_ext_type;
    }
    if (((input_type & INPUT_TYPE_MASK) == IMM_INPUT_TYPE_NUMERIC_PASSWORD) ||
        ((input_type & INPUT_TYPE_MASK) == IMM_INPUT_TYPE_ALPHANUMERIC_PASSWORD) ||
        ((input_type & INPUT_TYPE_MASK) == IMM_INPUT_TYPE_SAT_NUMERIC_PASSWORD) ||
        ((input_type & INPUT_TYPE_MASK) == IMM_INPUT_TYPE_SIGNED_DECIMAL_NUMERIC_PASSWORD) ||
        ((input_type & INPUT_TYPE_MASK) == IMM_INPUT_TYPE_SIGNED_NUMERIC_PASSWORD))
    {
        MMI_current_input_ext_type |= INPUT_TYPE_EXT_NO_SHOW_NEW_LINE_SYMBOL;
    }
    
    wgui_inputs_ml_handle_input_ext_type(input_type);

    /* if the editor is read-only, then inactivate it */
    if (g_wgui_cat2002_is_active_editor == MMI_FALSE)
    {
        /* set current status is actived editor */
        g_wgui_cat2002_is_active_editor = MMI_TRUE;

        wgui_cat2002_inactivate_editor(
            left_softkey, 
            left_softkey_icon, 
            right_softkey,
            right_softkey_icon,
            (UI_string_type)buffer,
            buffer_size);
        set_multiline_inputbox_category_history(cat_id, history_buffer);
    }
    
#ifdef __MMI_WALLPAPER_ON_BOTTOM__
    dm_get_scr_bg_opacity(&editor_scr_bg_opacity);
    dm_set_scr_bg_opacity((U8)(current_MMI_theme->bg_opacity_low));
#endif /* __MMI_WALLPAPER_ON_BOTTOM__ */

#if(UI_DOUBLE_BUFFER_SUPPORT)
    gui_unlock_double_buffer();
#endif
    
    ExitCategoryFunction = ExitCategory5Screen;
    dm_data.s32flags = DM_CLEAR_SCREEN_BACKGROUND;
    dm_data.s32flags |= DM_SHOW_VKPAD;
#if !defined(GUI_EDITOR_SHOW_TITLE)
    if ((cat_id != MMI_CAT2002_ID) && (cat_id != MMI_CAT2002_NO_TICKER_ID) && (!force_title))
    {
        dm_data.s32flags |= DM_NO_TITLE;
    }
#endif /* !defined(GUI_EDITOR_SHOW_TITLE) */
    
    dm_setup_category_functions(dm_redraw_category_screen, dm_get_category_history, dm_get_category_history_size);
    //dm_register_category_controlled_callback(category5callback);
    dm_data.s32ScrId = (S32) GetActiveScreenId();
    dm_data.s32CatId = cat_id;

    dm_setup_data(&dm_data);
    dm_register_vkpad_callback(mmi_imc_redraw_screen_by_state);
    dm_redraw_category_screen();
}


/* For detail description, please refer to wgui_categories_inputs.h */
void ShowCategory5Screen_ext(
        U16 title,
        U16 title_icon,
        U16 left_softkey,
        U16 left_softkey_icon,
        U16 right_softkey,
        U16 right_softkey_icon,
        U32 input_type,
        U8 *buffer,
        S32 buffer_size,
        U8 *history_buffer,
        S16 input_ext_type,
        mmi_imm_input_mode_enum *required_input_mode_set)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    gui_setup_common_layout();

#if defined(UI_SMALL_CATEGORY_EDITOR) 
    if (whether_no_small_screen())
    {
        ShowCategory100Screen(
            title,
            title_icon,
            left_softkey,
            left_softkey_icon,
            right_softkey,
            right_softkey_icon,
            input_type,
            buffer,
            buffer_size,
            history_buffer,
            input_ext_type,
            required_input_mode_set);
    }
    else
#endif /* defined(UI_SMALL_CATEGORY_EDITOR) */ 
    {
        wgui_cat_ml_inputbox_show_internal(
            get_string(title),
            get_image(title_icon),
            get_string(left_softkey),
            get_image(left_softkey_icon),
            get_string(right_softkey),
            get_image(right_softkey_icon),
            NULL,
            input_type,
            buffer,
            buffer_size,
            history_buffer,
            input_ext_type,
            required_input_mode_set,
            MMI_TRUE,
            MMI_FALSE,
            MMI_CATEGORY5_ID);
    }
}




/* For detail description, please refer to wgui_categories_inputs.h */
void wgui_cat2002_show(
        UI_string_type title,
        PU8 title_icon,
        UI_string_type left_softkey,
        PU8 left_softkey_icon,
        UI_string_type right_softkey,
        PU8 right_softkey_icon,      
        U8 *ticker_text,
        U8 *buffer,
        S32 buffer_size,
        U32 input_type,
        mmi_imm_input_mode_enum *required_input_mode_set,
        MMI_BOOL is_active_editor,
        S16 input_ext_type,
        U8 *history_buffer)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    S32 cat_id;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/  
    if (ticker_text != NULL)
    {
        cat_id = MMI_CAT2002_ID;
    }
    else
    {
#if defined(__MMI_MAINLCD_320X240__) 
        cat_id = MMI_CAT2002_NO_TICKER_ID; 
#else  /* (__MMI_MAINLCD_320X240__) */  
        cat_id = MMI_CATEGORY5_ID; 
#endif /* (__MMI_MAINLCD_320X240__) */
    }

    wgui_cat_ml_inputbox_show_internal(
        title,
        title_icon,
        left_softkey,
        left_softkey_icon,
        right_softkey,
        right_softkey_icon,
        ticker_text,
        input_type,
        buffer,
        buffer_size,
        history_buffer,
        input_ext_type,
        required_input_mode_set,
        is_active_editor,
        MMI_TRUE,
        cat_id);
}


/* For detail description, please refer to wgui_categories_inputs.h */
void wgui_cat2002_change_text(UI_string_type new_string, S32 buffer_size, MMI_BOOL is_reset_y)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    S32 l;
    S32 old_text_offset;
    U32 ml_flags;
    U32 ml_ext_flags;
        
    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    gdi_layer_lock_frame_buffer();
        
#ifdef __MMI_TOUCH_SCREEN__
    gui_multi_line_input_box_scroll_timer_hdlr();
#endif
    
    ml_flags = MMI_multiline_inputbox.flags;
    ml_ext_flags = MMI_multiline_inputbox.ext_flags;
    
    l = gui_strlen((UI_string_type) new_string);
    old_text_offset = MMI_multiline_inputbox.text_offset_y;

    gui_create_multi_line_input_box_set_buffer(
        &MMI_multiline_inputbox,
        MMI_multiline_inputbox.x,
        MMI_multiline_inputbox.y,
        MMI_multiline_inputbox.width,
        MMI_multiline_inputbox.height,
        (UI_string_type) new_string,
        buffer_size * 2,
        (l + 1) * 2,
        l);
        
#ifdef __MMI_TOUCH_SCREEN__
    /* if buffer chenged, clear the cursor position */
    g_wgui_inputs_ml_pen_down_cursor_p = NULL;
#endif /* __MMI_TOUCH_SCREEN__ */

    if (is_reset_y == MMI_FALSE)
    {
        MMI_multiline_inputbox.text_offset_y = old_text_offset;
    }
    
    MMI_multiline_inputbox.flags = ml_flags;
    MMI_multiline_inputbox.ext_flags = ml_ext_flags;

    if (g_wgui_cat2002_is_active_editor == MMI_FALSE)
    {
        MMI_multiline_inputbox.flags |= (UI_MULTI_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW | UI_MULTI_LINE_INPUT_BOX_VIEW_MODE);
    }
#ifdef __MMI_WALLPAPER_ON_BOTTOM__ 
    MMI_multiline_inputbox.flags |= UI_MULTI_LINE_INPUT_BOX_TRANSPARENT_BACKGROUND;
#endif

    if (g_wgui_cat2002_is_active_editor)
    {
        wgui_inputs_ml_set_RSK();
        MMI_multiline_inputbox.flags &= ~UI_MULTI_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW;
        MMI_multiline_inputbox.flags &= ~UI_MULTI_LINE_INPUT_BOX_VIEW_MODE;
        MMI_multiline_inputbox.ext_flags &= ~GUI_MULTI_LINE_INPUT_BOX_DISABLE_FORCE_CURSOR_APPEAR;
    }
    else
    {
        wgui_inputs_ml_show();
    }
    
    if (!mmi_imc_is_ime_state())
    {
        mmi_imc_redraw_screen_by_state();
    }
    else
    {
        mmi_imc_reset_ime_state();
    }    

    gdi_layer_unlock_frame_buffer();

    gdi_layer_blt_previous(0, 0, MAIN_LCD_DEVICE_WIDTH, MAIN_LCD_DEVICE_HEIGHT);
} 


/* For detail description, please refer to wgui_categories_inputs.h */
void wgui_cat2002_change_title(UI_string_type title_string, U16 title_icon)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    wgui_title_change(title_icon, 0, (U8*) title_string, WGUI_TITLE_CHANGE_ICON|WGUI_TITLE_CHANGE_TEXT);
    wgui_title_show(GUI_TITLE_PART_ALL);
}


/* For detail description, please refer to wgui_categories_inputs.h */
void wgui_cat2002_change_ticker(UI_string_type ticker_string, MMI_BOOL resize_editor)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    dm_coordinates ml_inputs_coordinates;
    dm_coordinates ticker_coordinates;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    gdi_layer_lock_frame_buffer();
    
    /* change the scroll text string */
    dm_change_scroll_text(0, ticker_string);
    if((ticker_string == NULL) || (ticker_string[0] == 0))
    {
#ifdef __MMI_WALLPAPER_ON_BOTTOM__
        dm_get_control_coordinates_from_category(
            -1,
            MMI_CAT2002_ID,
            DM_SCROLL_TEXT,
            -1,
            &ticker_coordinates);

        wgui_category_clear_region_with_transparent_color(
            (S32)ticker_coordinates.s16X,
            (S32)ticker_coordinates.s16Y,
            (S32)ticker_coordinates.s16X + (S32)ticker_coordinates.s16Width,
            (S32)ticker_coordinates.s16Y + (S32)ticker_coordinates.s16Height);
#endif/* __MMI_WALLPAPER_ON_BOTTOM__ */
    }
    else
    {
        dm_restart_scroll_text(0);
    } 
    

    if (resize_editor)
    {
        /* if no ticker, the editor area should be moved up and enlarged */
        if(ticker_string == NULL)
        {
            dm_get_control_coordinates_from_category(
                -1,
                MMI_CATEGORY5_ID,
                DM_MULTILINE_INPUTBOX1,
                -1,
                &ml_inputs_coordinates);
#if defined(__MMI_MAINLCD_320X240__) 
            ml_inputs_coordinates.s16Y += MMI_status_bar_height;
            ml_inputs_coordinates.s16Height -= MMI_status_bar_height;
            g_dm_data.s32CatId = MMI_CAT2002_NO_TICKER_ID; /* Todo: revise to invoke api */
#else
            g_dm_data.s32CatId = MMI_CATEGORY5_ID;
#endif /* defined(__MMI_MAINLCD_320X240__) */
        }
        else
        {
            dm_get_control_coordinates_from_category(
                -1,
                MMI_CAT2002_ID,
                DM_MULTILINE_INPUTBOX1,
                -1,
                &ml_inputs_coordinates);
            g_dm_data.s32CatId = MMI_CAT2002_ID;
        }

        if (g_wgui_cat2002_is_active_editor)
        {
            /* move and resize multiline inputbox */
            wgui_inputs_ml_move((S32) ml_inputs_coordinates.s16X,(S32) ml_inputs_coordinates.s16Y + INFORMATION_BAR_HEIGHT);
            wgui_inputs_ml_resize((S32) ml_inputs_coordinates.s16Width,(S32) ml_inputs_coordinates.s16Height - INFORMATION_BAR_HEIGHT);

            /* move information bar */
            wgui_inputs_setup_input_information(
                wgui_inputbox_information_bar_x,
                ml_inputs_coordinates.s16Y,
                wgui_inputbox_information_bar_width,
                wgui_inputbox_information_bar_height);
            
            /* redraw multiline inputbox, virtual keypad and info-bar */
            mmi_imc_redraw_screen_by_state();
            wgui_inputs_ml_redraw_input_information_bar();
        }
        else
        {
            /* move and resize multiline inputbox */
            wgui_inputs_ml_move((S32) ml_inputs_coordinates.s16X,(S32) ml_inputs_coordinates.s16Y);
            wgui_inputs_ml_resize((S32) ml_inputs_coordinates.s16Width,(S32) ml_inputs_coordinates.s16Height);

            /* redraw multiline inputbox */
            wgui_inputs_ml_show();
        }
    }
    gdi_layer_unlock_frame_buffer();
    gdi_layer_blt_previous(0, 0, MAIN_LCD_DEVICE_WIDTH, MAIN_LCD_DEVICE_HEIGHT);
}


/* For detail description, please refer to wgui_categories_inputs.h */
void wgui_cat2002_activate_editor(
        UI_string_type left_softkey,
        PU8 left_softkey_icon,
        UI_string_type right_softkey,
        PU8 right_softkey_icon,  
        U8 *buffer, 
        S32 buffer_size,
        U32 input_type,
        mmi_imm_input_mode_enum *required_input_mode_set)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    S32 l;
    S32 inputbox_x, inputbox_y, inputbox_width, inputbox_height;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (g_wgui_cat2002_is_active_editor == MMI_TRUE)
    {
        return;
    }
    else
    {
        gdi_layer_lock_frame_buffer();
        
        dm_add_softkey(left_softkey, left_softkey_icon, right_softkey, right_softkey_icon);

        /* resize the multiline inputbox */
        inputbox_x = MMI_multiline_inputbox.x;
        inputbox_y = MMI_multiline_inputbox.y;
        inputbox_width = MMI_multiline_inputbox.width;
        inputbox_height = UI_device_height - inputbox_y - MMI_SOFTKEY_HEIGHT;

        /* close the read-only multiline inputbox */
        wgui_inputs_ml_reset();

        /* setup the read only multiline inputbox */
        l = gui_strlen((UI_string_type) buffer);
        wgui_inputs_ml_create_set_buffer((UI_string_type) buffer, buffer_size, l, 0);
#if defined (__MMI_VIRTUAL_KEYBOARD__) && defined(__MMI_MAINLCD_320X240__)     
        wgui_inputs_ml_setup_ext2(
            inputbox_x,
            inputbox_y,
            inputbox_width,
            inputbox_height,
            buffer,
            buffer_size,
            MMI_CATEGORY5_ID,
            right_softkey,
            right_softkey_icon,
            input_type,
            NULL,
            required_input_mode_set,
            1,
            0,
            0,
            0,
            0,
            0,
            NULL,
            wgui_cat2002_ime_msg_callback);
#else  /* (__MMI_MAINLCD_320X240__) && (__MMI_VIRTUAL_KEYBOARD__) */
        wgui_inputs_ml_setup_ext(
            inputbox_x,
            inputbox_y,
            inputbox_width,
            inputbox_height,
            buffer,
            buffer_size,
            MMI_CATEGORY5_ID,
            right_softkey,
            right_softkey_icon,
            input_type,
            NULL,
            required_input_mode_set,
            1,
            0,
            0,
            0,
            0,
            0,
            NULL);        
#endif /* (__MMI_MAINLCD_320X240__) && (__MMI_VIRTUAL_KEYBOARD__) */
#ifdef __MMI_WALLPAPER_ON_BOTTOM__ 
        MMI_multiline_inputbox.flags |= UI_MULTI_LINE_INPUT_BOX_TRANSPARENT_BACKGROUND;
#endif 

        /* set the flag to editable inputbox */
        g_wgui_cat2002_is_active_editor = MMI_TRUE;

        /* redraw multiline inputbox, virtual keypad and info-bar */
        mmi_imc_redraw_screen_by_state();
        wgui_inputs_ml_redraw_input_information_bar();
        
        gdi_layer_unlock_frame_buffer();
        gdi_layer_blt_previous(0, 0, MAIN_LCD_DEVICE_WIDTH, MAIN_LCD_DEVICE_HEIGHT);
    }
}


/* For detail description, please refer to wgui_categories_inputs.h */
void wgui_cat2002_inactivate_editor(
        UI_string_type left_softkey,
        PU8 left_softkey_icon,
        UI_string_type right_softkey,
        PU8 right_softkey_icon, 
        UI_string_type buffer, 
        S32 buffer_size)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    S32 l;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (g_wgui_cat2002_is_active_editor == MMI_FALSE)
    {
        return;
    }
    else
    {
        gdi_layer_lock_frame_buffer();
        
        /* setup softkey */
        dm_add_softkey(left_softkey, left_softkey_icon, right_softkey, right_softkey_icon);

        /* resize the multiline inputbox */
        MMI_multiline_inputbox_y = MMI_multiline_inputbox.y - INFORMATION_BAR_HEIGHT;
        MMI_multiline_inputbox_height = UI_device_height - MMI_multiline_inputbox_y - MMI_SOFTKEY_HEIGHT;

        /* close the editable multiline inputbox */
        wgui_inputs_ml_close();

        /* setup the read only multiline inputbox */
        l = gui_strlen((UI_string_type) buffer);
        wgui_inputs_ml_create_set_buffer((UI_string_type) buffer, buffer_size, l, 0);

		/* set key handler */
		set_right_softkey_function(NULL, KEY_EVENT_LONG_PRESS);
        wgui_inputs_ml_register_viewer_keys();

        MMI_multiline_inputbox.flags |= (UI_MULTI_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW | UI_MULTI_LINE_INPUT_BOX_VIEW_MODE);
        #ifdef __MMI_WALLPAPER_ON_BOTTOM__ 
        MMI_multiline_inputbox.flags |= UI_MULTI_LINE_INPUT_BOX_TRANSPARENT_BACKGROUND;
        #endif 

        /* set the flag to Read-only inputbox */
        g_wgui_cat2002_is_active_editor = MMI_FALSE;

        /* redraw multiline inputbox and softkey */
        wgui_inputs_ml_show();
        redraw_softkey(MMI_LEFT_SOFTKEY);
        redraw_softkey(MMI_RIGHT_SOFTKEY);
        #ifdef __MMI_WGUI_CSK_ENABLE__
        redraw_softkey(MMI_CENTER_SOFTKEY);
        #endif
        
        gdi_layer_unlock_frame_buffer();
        gdi_layer_blt_previous(0, 0, MAIN_LCD_DEVICE_WIDTH, MAIN_LCD_DEVICE_HEIGHT);
    }
}


/* For detail description, please refer to wgui_categories_inputs.h */
S32 wgui_cat2002_get_cursor_index(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (g_wgui_cat2002_is_active_editor == MMI_FALSE)
    {
        return WGUI_CAT2002_INPUTBOX_NO_CURSOR;
    }
    else
    {
        return wgui_inputs_ml_get_cursor_index();
    }
}


/* For detail description, please refer to wgui_categories_inputs.h */
void wgui_cat2002_change_input_type(U32 input_type, mmi_imm_input_mode_enum *input_mode_array)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (input_type & IMM_INPUT_TYPE_EXT_PASSWORD)
    {
        wgui_inputs_ml_set_mask(1);
    }

    if (g_wgui_cat2002_is_active_editor == MMI_FALSE)
    {
        return;
    }
    else
    {
        mmi_imm_set_required_mode_list(input_type & INPUT_TYPE_MASK, input_mode_array, IMM_INPUT_MODE_NONE);
        mmi_imc_connect((void *)&g_mmi_editor_hanler, mmi_input_box_msg_call_back_multiline);
        wgui_inputs_ml_set_decimal_flag(input_type);
        mmi_imc_redraw_screen_by_state();
        wgui_inputs_ml_redraw_input_information_bar();
    }
}


/* For detail description, please refer to wgui_categories_inputs.h */
void wgui_cat2002_stop_scroll_text(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    dm_stop_scroll_text(0);
}


#if defined (__MMI_VIRTUAL_KEYBOARD__) && defined(__MMI_MAINLCD_320X240__) 
#define WGUI_CAT2002_EDITOR_MIN_HEIGHT (Get_CharDisplayHeightOfAllLangAndType(MMI_medium_font.size) + 2)
/*****************************************************************************
 * FUNCTION
 *  wgui_cat2002_adjust_ticker_and_editor
 * DESCRIPTION
 *  if the height of the multiline inputbox is too small, the ticker shoule be hide.
 * PARAMETERS
 *  imui_x :                [IN] (N/A) X-axis of the input mode ui.
 *  imui_y :                [IN] (N/A) Y-axis of the input mode ui.
 *  imui_w :                [IN] (N/A) Width of the input mode ui.
 *  imui_h :                [IN] (N/A) Height of the input mode ui.
 * RETURNS
 *  U32
 *****************************************************************************/
static void wgui_cat2002_adjust_ticker_and_editor(S32 imui_x, S32 imui_y, S32 imui_w, S32 imui_h)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    static MMI_BOOL has_ticker = MMI_TRUE;
    dm_coordinates ml_inputs_coordinates;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if ( imui_y < MMI_status_bar_height + wgui_inputbox_information_bar_height + MMI_SINGLELINE_INPUTBOX_HEIGHT + WGUI_CAT2002_EDITOR_MIN_HEIGHT)
    {
        /* hide ticker and move up inputbox */
        if (dm_stop_scroll_text(0) == MMI_TRUE)
        {
            has_ticker = MMI_FALSE;
            gdi_layer_lock_frame_buffer();

            /* move and resize multiline inputbox */
            wgui_inputs_ml_move(MMI_COMMON_CONTENT_X, MMI_COMMON_CONTENT_Y + INFORMATION_BAR_HEIGHT);
            wgui_inputs_ml_resize(MMI_COMMON_CONTENT_WIDTH, imui_y - MMI_COMMON_CONTENT_Y - INFORMATION_BAR_HEIGHT);
            
            /* move information bar */
            wgui_inputs_setup_input_information(
                wgui_inputbox_information_bar_x,
                MMI_COMMON_CONTENT_Y,
                wgui_inputbox_information_bar_width,
                wgui_inputbox_information_bar_height);
            
            /* redraw multiline inputbox, virtual keypad and info-bar */
            wgui_inputs_ml_show();
            wgui_inputs_ml_redraw_input_information_bar();
            
            gdi_layer_unlock_frame_buffer();
            gdi_layer_blt_previous(0, 0, MAIN_LCD_DEVICE_WIDTH, MAIN_LCD_DEVICE_HEIGHT);
        }
    }
    else
    {
        /* show ticker and move down inputbox */
        if (has_ticker == MMI_FALSE)
        {
            if (dm_restart_scroll_text(0) == MMI_TRUE)
            {
                has_ticker = MMI_TRUE;
                gdi_layer_lock_frame_buffer();
                dm_get_control_coordinates_from_category(
                    -1,
                    MMI_CAT2002_ID,
                    DM_MULTILINE_INPUTBOX1,
                    -1,
                    &ml_inputs_coordinates);

                /* move and resize multiline inputbox */
                wgui_inputs_ml_move((S32) ml_inputs_coordinates.s16X,(S32) ml_inputs_coordinates.s16Y + INFORMATION_BAR_HEIGHT);
                wgui_inputs_ml_resize((S32) ml_inputs_coordinates.s16Width,(S32) ml_inputs_coordinates.s16Height - imui_h - INFORMATION_BAR_HEIGHT);

                /* move information bar */
                wgui_inputs_setup_input_information(
                    wgui_inputbox_information_bar_x,
                    ml_inputs_coordinates.s16Y,
                    wgui_inputbox_information_bar_width,
                    wgui_inputbox_information_bar_height);
            
                /* redraw multiline inputbox, virtual keypad and info-bar */
                wgui_inputs_ml_show();
                wgui_inputs_ml_redraw_input_information_bar();

                gdi_layer_unlock_frame_buffer();
                gdi_layer_blt_previous(0, 0, MAIN_LCD_DEVICE_WIDTH, MAIN_LCD_DEVICE_HEIGHT);
            }
        }
    }
}

/*****************************************************************************
 * FUNCTION
 *  wgui_cat2002_ime_msg_callback
 * DESCRIPTION
 *  ime callback function
 * PARAMETERS
 *  input_box_handle :      [IN] (N/A) inputbox handle
 *  msg_ptr :               [IN] (N/A) imui size info
 * RETURNS
 *  U32
 *****************************************************************************/
static U32 wgui_cat2002_ime_msg_callback(void * input_box_handle, mmi_imc_message_struct_p msg_ptr)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    multi_line_input_box * editor_ptr;
    U32 lresult = 0;
    mmi_imc_rect_p imui_rect_p;
    
    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    editor_ptr = (multi_line_input_box *)((mmi_editor_handler_struct *)input_box_handle)->input_box_handler;
    MMI_ASSERT(editor_ptr == &MMI_multiline_inputbox);
    
    switch (msg_ptr->message_id)
    {
        case MMI_IMC_MESSAGE_IMUI_RECTANGLE_IS_UPDATED:
            imui_rect_p = (mmi_imc_rect_p)(msg_ptr->param_0);
            wgui_cat2002_adjust_ticker_and_editor(imui_rect_p->x, imui_rect_p->y, imui_rect_p->width, imui_rect_p->height);
            lresult = MMI_TRUE;
            break;

        default:
            lresult = mmi_input_box_msg_call_back_multiline(input_box_handle, msg_ptr);
            break;
    }
    return lresult;
}
#endif /* (__MMI_MAINLCD_320X240__) && (__MMI_VIRTUAL_KEYBOARD__) */


#define CAT505_HEADER_HEIGHT   30
static void (*cat505_control_area_click)(void);
static S32 cat505_start_x, cat505_end_x, cat505_start_y, cat505_end_y;

/*****************************************************************************
* FUNCTION
*  cat505_redraw_img
* DESCRIPTION
*  cat505_redraw_img
* PARAMETERS
*  yy      [IN]        (not used)
*  x1      [IN]        start  x
*  y1      [IN]        start  y
*  x2      [IN]        end  x
*  y2      [IN]        end  y
* RETURNS
*  void
*****************************************************************************/
static void cat505_redraw_img(MMI_BOOL is_draw, S32 yy, S32 height, S32 x1, S32 y1, S32 x2, S32 y2)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    S32 header_y2, w, h;
    UI_string_type string = (UI_string_type)(L"Go");
    
    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (is_draw == MMI_FALSE)
    {
        return ;
    }

    header_y2 = yy + height - 1;

    gui_push_clip();
    gui_set_clip(x1, y1, x2, header_y2>y2 ? y2 : header_y2);

    /* please show your desired image, currently just show a string */
    
    gui_measure_string(string, &w, &h);
    cat505_start_x = x1 + (x2 - x1 - w)/2;
    cat505_end_x = cat505_start_x + w;
    cat505_start_y = (CAT505_HEADER_HEIGHT - h)/2;
    cat505_end_y = cat505_start_y + h;
    gui_move_text_cursor(cat505_start_x, yy + cat505_start_y);
    gui_print_text((UI_string_type)string);
    
    gui_pop_clip();
    
}

/*****************************************************************************
 * FUNCTION
*  cat505_header_callback
* DESCRIPTION
*  cat505_header_callback
* PARAMETERS
*  type      [IN]      area type
*  x         [IN]      pen down x
*  y         [IN]      pen down y
* RETURNS
*  void
*****************************************************************************/
static void cat505_click_callback(U8 type, S32 x, S32 y)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    
    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (type == 0)
    {
        /* click at the header area */
        if (x >= cat505_start_x && x <= cat505_end_x
            && y >= cat505_start_y && y <= cat505_end_y)
        {
            if (cat505_control_area_click != NULL)
                cat505_control_area_click();
        }
    }
    else
    {
        /* click at the footer area */
    }
}

/* For detail description, please refer to wgui_categories_inputs.h */
void ShowCategory505Screen(
        U16 title,
        U16 title_icon,
        U16 left_softkey,
        U16 left_softkey_icon,
        U16 right_softkey,
        U16 right_softkey_icon,
        U32 input_type,
        U8 *buffer,
        S32 buffer_size,
        U8 *history_buffer,
        S16 input_ext_type,
        void (*control_area_click)(void),
        mmi_imm_input_mode_enum *required_input_mode_set)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    S32 header_height = 0;
    dm_data_struct dm_data;
    S32 inputbox_x = 0;
    S32 inputbox_y = (MMI_title_y + MMI_title_height);
    S32 inputbox_width = MMI_content_width;

#if defined(__MMI_FULL_SCREEN_EDITOR__)
    S32 inputbox_height = MMI_content_height;
#else 
    S32 inputbox_height = MMI_content_height - MMI_multitap_height;
#endif

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    gui_setup_common_layout();

#if(UI_DOUBLE_BUFFER_SUPPORT)
    gui_lock_double_buffer();
#endif 

    wgui_title_set_menu_shortcut_number(-1);
    wgui_title_disable_menu_shortcut_display(MMI_TRUE);
    clear_category_screen_key_handlers();
    change_left_softkey(left_softkey, left_softkey_icon);
    change_right_softkey(right_softkey, right_softkey_icon);
    clear_left_softkey();
    clear_right_softkey();
    register_left_softkey_handler();
    register_right_softkey_handler();
    register_default_hide_softkeys();

    MMI_title_string = (UI_string_type) get_string(title);
    MMI_title_icon = (PU8) get_image(title_icon);

    wgui_inputs_ml_setup_ext(
        inputbox_x,
        inputbox_y,
        inputbox_width,
        inputbox_height,
        buffer,
        buffer_size,
        MMI_CATEGORY5_ID,
        get_string(right_softkey),
        get_image(right_softkey_icon),
        input_type,
        history_buffer,
        required_input_mode_set,
        1,
        0,
        0,
        0,
        (S16)header_height,
        0,
        NULL);

    /* if need to use footer, please set the footer_height and footer_callback */
    MMI_multiline_inputbox.header_height = CAT505_HEADER_HEIGHT;  
    MMI_multiline_inputbox.header_callback = cat505_redraw_img; 
    //MMI_multiline_inputbox.footer_height = CAT505_HEADER_HEIGHT;  
    //MMI_multiline_inputbox.footer_callback = cat505_redraw_img;
    MMI_multiline_inputbox.pen_down_control_area_callback = cat505_click_callback;
    cat505_control_area_click = control_area_click;
    
    wgui_inputs_ml_set_common_style(MMI_TRUE, MMI_TRUE);

    /* if input method changed from "option", and language changed then delete all character in case of dictionary */
    if (wgui_check_editor_buffer_need_flush)
    {
        if (wgui_check_editor_buffer_need_flush())
        {
            wgui_inputs_ml_delete_all_characters();
            set_right_softkey_function(GoBackHistory, KEY_EVENT_UP);
        }
    }

    if (input_ext_type != 0)
    {
        MMI_current_input_ext_type = input_ext_type;
    }
    if (((input_type & INPUT_TYPE_MASK) == IMM_INPUT_TYPE_NUMERIC_PASSWORD) ||
        ((input_type & INPUT_TYPE_MASK) == IMM_INPUT_TYPE_ALPHANUMERIC_PASSWORD) ||
        ((input_type & INPUT_TYPE_MASK) == IMM_INPUT_TYPE_SAT_NUMERIC_PASSWORD) ||
        ((input_type & INPUT_TYPE_MASK) == IMM_INPUT_TYPE_SIGNED_DECIMAL_NUMERIC_PASSWORD) ||
        ((input_type & INPUT_TYPE_MASK) == IMM_INPUT_TYPE_SIGNED_NUMERIC_PASSWORD))
    {
        MMI_current_input_ext_type |= INPUT_TYPE_EXT_NO_SHOW_NEW_LINE_SYMBOL;
    }

#ifdef __MMI_WALLPAPER_ON_BOTTOM__
    dm_get_scr_bg_opacity(&editor_scr_bg_opacity);
    dm_set_scr_bg_opacity((U8)(current_MMI_theme->bg_opacity_low));
#endif /* __MMI_WALLPAPER_ON_BOTTOM__ */

    gui_unlock_double_buffer();

    ExitCategoryFunction = ExitCategory5Screen;
    dm_data.s32flags = DM_CLEAR_SCREEN_BACKGROUND;
    dm_data.s32flags |= DM_SHOW_VKPAD;
#if !defined(GUI_EDITOR_SHOW_TITLE)
    dm_data.s32flags |= DM_NO_TITLE;
#endif /* !defined(GUI_EDITOR_SHOW_TITLE) */

    dm_setup_category_functions(dm_redraw_category_screen, dm_get_category_history, dm_get_category_history_size);
    //dm_register_category_controlled_callback(category5callback);
    dm_data.s32ScrId = (S32) GetActiveScreenId();
    dm_data.s32CatId = MMI_CATEGORY5_ID;
    dm_setup_data(&dm_data);
    dm_register_vkpad_callback(mmi_imc_redraw_screen_by_state);
    dm_redraw_category_screen();
}


/*****************************************************************************
 * FUNCTION
 *  ExitCategory5Screen
 * DESCRIPTION
 *  Exits the category5 screen
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void ExitCategory5Screen(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if(g_wgui_cat2002_is_active_editor)
    {
    wgui_inputs_ml_close();
    }
    else
    {
        wgui_inputs_ml_reset();
        g_wgui_cat2002_is_active_editor = MMI_TRUE;
    }
    
    /* stop scroll text */
    dm_stop_scroll_text(0);

    /* changed when activate/inactivate editor */
    MMI_multiline_inputbox_y = MMI_MULTILINE_INPUTBOX_Y;
    MMI_multiline_inputbox_height = UI_DEVICE_HEIGHT;
    
    reset_softkeys();
    wgui_check_editor_buffer_need_flush = NULL;
#ifdef __MMI_WALLPAPER_ON_BOTTOM__
    dm_set_scr_bg_opacity(editor_scr_bg_opacity);
#endif /* __MMI_WALLPAPER_ON_BOTTOM__ */ 
  
#ifdef UI_SMALL_LIST_SCREEN
    restore_small_screen();
#endif 
    g_title_in_header = 0;
}


/*****************************************************************************
 * FUNCTION
 *  GetCategory5HistorySize
 * DESCRIPTION
 *  Gets the size of the history buffer for category5 screen
 * PARAMETERS
 *  void
 * RETURNS
 *  size in U8s of the history buffer
 *****************************************************************************/
S32 GetCategory5HistorySize(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    return (sizeof(multiline_inputbox_category_history));
}


/*****************************************************************************
 * FUNCTION
 *  GetCategory5History
 * DESCRIPTION
 *  Gets the history buffer for category5 screen
 * PARAMETERS
 *  history_buffer      [IN]        Is the buffer into which the history data is stored (pre-allocated)
 * RETURNS
 *  Pointer to the history buffer
 *****************************************************************************/
U8 *GetCategory5History(U8 *history_buffer)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    wgui_inputs_ml_get_category_history(MMI_CATEGORY5_ID, history_buffer);
    return (history_buffer);
}

#ifdef UI_SMALL_CATEGORY_EDITOR


/* For detail description, please refer to wgui_categories_inputs.h */
void ShowCategory100Screen(
        U16 title,
        U16 title_icon,
        U16 left_softkey,
        U16 left_softkey_icon,
        U16 right_softkey,
        U16 right_softkey_icon,
        U32 input_type,
        U8 *buffer,
        S32 buffer_size,
        U8 *history_buffer,
        S16 input_ext_type,
        mmi_imm_input_mode_enum *required_input_mode_set)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    dm_data_struct dm_data;
    color c = {0, 0, 0, 100};
    UI_filled_area *title_filler;
    
    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    title_filler = current_window_title_theme->active_filler;
    current_window_title_theme->active_filler = current_MMI_theme->small_screen_title_filler;
    gui_title_set_theme(&g_wgui_title_bar, current_window_title_theme);
    gui_setup_common_layout();
    MMI_multiline_inputbox_x = MMI_SMALL_SCREEN_X_OFFSET;
    MMI_multiline_inputbox_y = MMI_title_y + 2 * MMI_title_height + MMI_SMALL_SCREEN_Y_OFFSET;
    MMI_multiline_inputbox_width = MMI_content_width - 2 * MMI_SMALL_SCREEN_X_OFFSET;
    MMI_multiline_inputbox_height = MMI_content_height - 2 * (MMI_SMALL_SCREEN_Y_OFFSET) - MMI_title_height + 1;
    MMI_multitap_x = MMI_SMALL_SCREEN_X_OFFSET + 1;
    MMI_multitap_y -= (MMI_SMALL_SCREEN_Y_OFFSET + 1);
	
    MMI_multitap_width = UI_DEVICE_WIDTH - 2 * (MMI_SMALL_SCREEN_X_OFFSET + 1); /* The border width is 1 */
    g_small_editor_category_present = TRUE;

#ifdef __MMI_UI_SMALL_SCREEN_SUPPORT__
    wgui_status_icon_integrated_enable(MMI_FALSE);
    set_small_screen();
    wgui_small_editor_information_flag = 1;
    gui_add_cleanup_hook(disable_resized_small_screen);
#endif /* __MMI_UI_SMALL_SCREEN_SUPPORT__ */ 

    hide_status_icon_bar(0);/* early status icon */

#if(UI_DOUBLE_BUFFER_SUPPORT)
    gui_lock_double_buffer();
#endif 

    wgui_title_set_menu_shortcut_number(-1);
    wgui_title_disable_menu_shortcut_display(MMI_TRUE);
    clear_category_screen_key_handlers();
    change_left_softkey(left_softkey, left_softkey_icon);
    change_right_softkey(right_softkey, right_softkey_icon);
    clear_left_softkey();
    clear_right_softkey();
    register_left_softkey_handler();
    register_right_softkey_handler();
    register_default_hide_softkeys();

    MMI_title_string = (UI_string_type) get_string(title);

#ifdef GUI_COMMON_USE_THICK_TITLE
    MMI_title_icon = NULL;
#else
    MMI_title_icon = (PU8) get_image(title_icon); 
#endif

    wgui_inputs_ml_setup_ext(
        MMI_multiline_inputbox_x,
        MMI_multiline_inputbox_y,
        MMI_multiline_inputbox_width,
        MMI_multiline_inputbox_height,
        buffer,
        buffer_size,
        MMI_CATEGORY100_ID,
        get_string(right_softkey),
        get_image(right_softkey_icon),
        input_type,
        history_buffer,
        required_input_mode_set,
        1,
        0,
        0,
        0,
        0,
        0,
        NULL);
    
    if (input_ext_type != 0)
    {
        MMI_current_input_ext_type = input_ext_type;
    }
    if (((input_type & INPUT_TYPE_MASK) == IMM_INPUT_TYPE_NUMERIC_PASSWORD) ||
        ((input_type & INPUT_TYPE_MASK) == IMM_INPUT_TYPE_ALPHANUMERIC_PASSWORD) ||
        ((input_type & INPUT_TYPE_MASK) == IMM_INPUT_TYPE_SAT_NUMERIC_PASSWORD) ||
        ((input_type & INPUT_TYPE_MASK) == IMM_INPUT_TYPE_SIGNED_DECIMAL_NUMERIC_PASSWORD) ||
        ((input_type & INPUT_TYPE_MASK) == IMM_INPUT_TYPE_SIGNED_NUMERIC_PASSWORD))
    {
        MMI_current_input_ext_type |= INPUT_TYPE_EXT_NO_SHOW_NEW_LINE_SYMBOL;
    }

    gui_unlock_double_buffer();

    /* To fix title issue */
    gOnFullScreen = MMI_LEAVE_BG_ON_BOTTOM_SCREEN;

    ExitCategoryFunction = ExitCategory100Screen;
    dm_data.s32flags = /* DM_NO_FLAGS */ DM_NO_POPUP_BACKGROUND;
    dm_setup_category_functions(dm_redraw_category_screen, dm_get_category_history, dm_get_category_history_size);
    dm_register_category_controlled_callback(category5callback);
    dm_add_rectangle(c, DM_RECTANGLE_FILL_GRAYSCALE);
    dm_add_rectangle(c, 0);
    dm_data.s32ScrId = (S32) GetActiveScreenId();
    dm_data.s32CatId = MMI_CATEGORY100_ID;
    dm_setup_data(&dm_data);
    dm_redraw_category_screen();

    current_window_title_theme->active_filler = title_filler;
    gui_title_set_theme(&g_wgui_title_bar, current_window_title_theme);
}


/*****************************************************************************
 * FUNCTION
 *  ExitCategory100Screen
 * DESCRIPTION
 *  
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void ExitCategory100Screen(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    MMI_multiline_inputbox_x = MMI_MULTILINE_INPUTBOX_X;
    MMI_multiline_inputbox_y = MMI_MULTILINE_INPUTBOX_Y;
    MMI_multiline_inputbox_height = UI_DEVICE_HEIGHT;
    MMI_multiline_inputbox_width = UI_DEVICE_WIDTH;
    wgui_small_editor_information_flag = 0;
    MMI_multitap_x = MMI_MULTITAP_X;
    MMI_multitap_y = (UI_device_height - MMI_BUTTON_BAR_HEIGHT - MMI_multitap_height);/* MMI_MULTITAP_Y*/;
    MMI_multitap_width = UI_device_width - 4;

    g_small_editor_category_present = FALSE;
#ifdef __MMI_UI_SMALL_SCREEN_SUPPORT__
    reset_small_screen();

#if (__MMI_UI_FADE_EFFECT_STYLE__ == MMI_UI_FADE_EFFECT_STYLE_DARKEN)
    {
        S32 x1 = MMI_SMALL_SCREEN_X_OFFSET;
        S32 y1 = MMI_COMMON_TITLE_Y + MMI_COMMON_TITLE_HEIGHT + MMI_SMALL_SCREEN_Y_OFFSET;
        S32 x2 = MMI_COMMON_CONTENT_WIDTH - MMI_SMALL_SCREEN_X_OFFSET;
        S32 y2 = MMI_COMMON_TITLE_Y + MMI_COMMON_TITLE_HEIGHT + MMI_COMMON_CONTENT_HEIGHT - MMI_SMALL_SCREEN_Y_OFFSET;
        gdi_handle ative_layer;
        
        gdi_layer_set_clip(x1, y1, x2, y2);
        gdi_layer_get_active(&ative_layer);
        gdi_layer_flatten_with_clipping(ative_layer, 0, 0, 0);
        gdi_draw_darken_rect(x1, y1, x2, y2, 75);
    }
#endif

#endif

    title_bg_id = 0;

    show_status_icon_bar(0); /* early status icon */
    wgui_inputs_ml_close();
    reset_softkeys();
    entry_full_screen();
    ExitCategoryFunction = MMI_dummy_function;
    RedrawCategoryFunction = MMI_dummy_function;
    GetCategoryHistory = dummy_get_history;
    GetCategoryHistorySize = dummy_get_history_size;

}

#endif /* UI_SMALL_CATEGORY_EDITOR */ 


/*****************************************************************************
 * FUNCTION
 *  category35callback
 * DESCRIPTION
 *  
 * PARAMETERS
 *  coordinate      [?]     
 * RETURNS
 *  void
 *****************************************************************************/
void category35callback(dm_coordinates *coordinate)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    gui_show_multi_line_input_box(&cat35_message_box);
    coordinate->s16X = cat35_message_box.x;
    coordinate->s16Y = cat35_message_box.y;
    coordinate->s16Width = cat35_message_box.width;
    coordinate->s16Height = cat35_message_box.height;
}


/*****************************************************************************
 * FUNCTION
 *  SetCategory35RightSoftkeyFunction
 * DESCRIPTION
 *  register RSK function handler of category 35
 * PARAMETERS
 *  f       [IN]        
 *  k       [IN]        
 * RETURNS
 *  void
 *****************************************************************************/
void SetCategory35RightSoftkeyFunction(void (*f) (void), MMI_key_event_type k)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    UI_UNUSED_PARAMETER(k);
    wgui_inputbox_RSK_function = f;
}


/*****************************************************************************
 * FUNCTION
 *  category35_message_box_previous_line
 * DESCRIPTION
 *  move to previous line of multi line box of category 35
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void category35_message_box_previous_line(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    gui_multi_line_input_box_previous_line(&cat35_message_box);
    gui_show_multi_line_input_box(&cat35_message_box);
#if(UI_DOUBLE_BUFFER_SUPPORT)
    gui_BLT_double_buffer(
        cat35_message_box.x,
        cat35_message_box.y,
        cat35_message_box.x + cat35_message_box.width - 1,
        cat35_message_box.y + cat35_message_box.height - 1);
#endif /* (UI_DOUBLE_BUFFER_SUPPORT) */ 
}


/*****************************************************************************
 * FUNCTION
 *  category35_message_box_next_line
 * DESCRIPTION
 *  move to next  line of multi line box of category 35
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void category35_message_box_next_line(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    gui_multi_line_input_box_next_line(&cat35_message_box);
    gui_show_multi_line_input_box(&cat35_message_box);
#if(UI_DOUBLE_BUFFER_SUPPORT)
    gui_BLT_double_buffer(
        cat35_message_box.x,
        cat35_message_box.y,
        cat35_message_box.x + cat35_message_box.width - 1,
        cat35_message_box.y + cat35_message_box.height - 1);
#endif /* (UI_DOUBLE_BUFFER_SUPPORT) */ 
}


/*****************************************************************************
 * FUNCTION
 *  category35_keyboard_key_handler
 * DESCRIPTION
 *  key board handling of category 35
 * PARAMETERS
 *  vkey_code       [IN]        
 *  key_state       [IN]        
 * RETURNS
 *  void
 *****************************************************************************/
void category35_keyboard_key_handler(S32 vkey_code, S32 key_state)
{
#if(MMI_BUILD_TYPE == BUILD_TYPE_X86WIN32)
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (key_state)
    {
        switch (vkey_code)
        {
            case 37:
                wgui_inputs_ml_previous_character();
                break;
            case 39:
                wgui_inputs_ml_next_character();
                break;
            case 38:
                category35_message_box_previous_line();
                break;
            case 40:
                category35_message_box_next_line();
                break;
            case 45:
                wgui_inputs_ml_toggle_insert_mode();
                break;
            case 46:
                wgui_inputs_ml_delete_current_character();
                break;
        }
    }
#else /* (MMI_BUILD_TYPE == BUILD_TYPE_X86WIN32) */ 
    UI_UNUSED_PARAMETER(vkey_code);
    UI_UNUSED_PARAMETER(key_state);
#endif /* (MMI_BUILD_TYPE == BUILD_TYPE_X86WIN32) */ 
}


/*****************************************************************************
 * FUNCTION
 *  cat35_virtual_keypad_callback
 * DESCRIPTION
 *  
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void cat35_virtual_keypad_callback(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
#if defined(__MMI_TOUCH_SCREEN__)
    mmi_imc_redraw_screen_by_state();
#endif 
}


/* For detail description, please refer to wgui_categories_inputs.h */
void ShowCategory35Screen(
        U8 *left_softkey,
        PU8 left_softkey_icon,
        U8 *right_softkey,
        PU8 right_softkey_icon,
        U8 *message,
        PU8 message_icon,
        U32 input_type,
        U8 *buffer,
        S32 buffer_size,
        U8 *history_buffer)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    dm_data_struct dm_data;
    S32 l, x = 24;
    S32 inputbox_x, inputbox_y, inputbox_width, inputbox_height;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    UI_UNUSED_PARAMETER(history_buffer);
    gui_setup_common_layout();
    
#if(UI_DOUBLE_BUFFER_SUPPORT)
    gui_lock_double_buffer();
#endif 

    wgui_title_set_menu_shortcut_number(-1);
    clear_category_screen_key_handlers();
    set_left_softkey_label((UI_string_type) left_softkey);
    set_left_softkey_icon(left_softkey_icon);
    set_right_softkey_label((UI_string_type) right_softkey);
    set_right_softkey_icon(right_softkey_icon);
    clear_left_softkey();
    clear_right_softkey();
    register_left_softkey_handler();
    register_right_softkey_handler();
    register_default_hide_softkeys();
    MMI_message_string = (UI_string_type) message;
    MMI_message_icon = message_icon;
    wgui_set_animation_image(x >> 1, (MMI_title_y + MMI_title_height), (PU8) message_icon);
    if (message_icon == NULL)
    {
        x = 0;
    }

    inputbox_x = 0;
    inputbox_y = (MMI_title_y + MMI_title_height) << 1;
    inputbox_width = UI_device_width;
    inputbox_height = MMI_content_height - (MMI_title_y + MMI_title_height) - (MMI_multitap_height << 1) + 4;
    wgui_inputs_ml_setup(
        inputbox_x,
        inputbox_y,
        inputbox_width,
        inputbox_height,
        buffer,
        buffer_size,
        MMI_CATEGORY5_ID,
        (UI_string_type) right_softkey,
        (PU8) right_softkey_icon,
        input_type,
        history_buffer,
        1);
    l = gui_strlen(MMI_message_string);
    /* changed code vandana mehtani iheight +9 */
    gui_create_multi_line_input_box_set_buffer(
        &cat35_message_box,
        x,
        MMI_title_y,
        UI_device_width - x + 1,
        (MMI_title_height) << 1,
        MMI_message_string,
        l,
        l,
        0);
    /* end of changed code vandana mehtani */
    /* Add flags for input box here   */
    cat35_message_box.flags |=
        (UI_MULTI_LINE_INPUT_BOX_DISABLE_DRAW | UI_MULTI_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW |
         UI_MULTI_LINE_INPUT_BOX_VIEW_MODE);
    gui_show_multi_line_input_box(&cat35_message_box);
    cat35_message_box.flags &= ~UI_MULTI_LINE_INPUT_BOX_DISABLE_DRAW;
    register_keyboard_key_handler(category35_keyboard_key_handler);
    SetKeyHandler(category35_message_box_previous_line, KEY_UP_ARROW, KEY_EVENT_DOWN);
    SetKeyHandler(category35_message_box_next_line, KEY_DOWN_ARROW, KEY_EVENT_DOWN);
    SetKeyHandler(category35_message_box_previous_line, KEY_UP_ARROW, KEY_REPEAT);
    SetKeyHandler(category35_message_box_next_line, KEY_DOWN_ARROW, KEY_REPEAT);

    inputbox_height =
        UI_device_height - MMI_button_bar_height - wgui_inputbox_information_bar_height - cat35_message_box.height -
        MMI_multitap_height;
    wgui_inputs_ml_resize(WGUI_INPUTS_STYLE_DEFAULT, inputbox_height);

    wgui_inputs_ml_set_common_style(MMI_FALSE, MMI_TRUE);

#ifdef __MMI_WALLPAPER_ON_BOTTOM__
    dm_get_scr_bg_opacity(&editor_scr_bg_opacity);
    dm_set_scr_bg_opacity((U8)(current_MMI_theme->bg_opacity_low));
#endif /* __MMI_WALLPAPER_ON_BOTTOM__ */ 

#if(UI_DOUBLE_BUFFER_SUPPORT)
    gui_unlock_double_buffer();
#endif 
    ExitCategoryFunction = ExitCategory35Screen;
    dm_setup_category_functions(dm_redraw_category_screen, dm_get_category_history, dm_get_category_history_size);
    dm_register_category_controlled_callback(category35callback);
    dm_data.s32ScrId = (S32) GetActiveScreenId();
    dm_data.s32CatId = MMI_CATEGORY35_ID;
    dm_data.s32flags = DM_CLEAR_SCREEN_BACKGROUND;
    dm_data.s32flags |= DM_SHOW_VKPAD;
    dm_setup_data(&dm_data);
    dm_register_vkpad_callback(cat35_virtual_keypad_callback);
    dm_redraw_category_screen();
}


/*****************************************************************************
 * FUNCTION
 *  ExitCategory35Screen
 * DESCRIPTION
 *  Exits the dynamic icon notification with user input screen
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void ExitCategory35Screen(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
#if(UI_BLINKING_CURSOR_SUPPORT)
    StopTimer(BLINKING_CURSOR);

#endif /* (UI_BLINKING_CURSOR_SUPPORT) */ 
    reset_softkeys();
    wgui_inputs_ml_close();

#ifdef __MMI_WALLPAPER_ON_BOTTOM__
    dm_set_scr_bg_opacity(editor_scr_bg_opacity);
#endif /* __MMI_WALLPAPER_ON_BOTTOM__ */ 

    ExitCategoryFunction = MMI_dummy_function;
    RedrawCategoryFunction = MMI_dummy_function;
    GetCategoryHistory = dummy_get_history;
    GetCategoryHistorySize = dummy_get_history_size;
}

/* Category 171: SAT edit screen (Equivalent to Cat-35)           */


/*****************************************************************************
 * FUNCTION
 *  SetCategory171RightSoftkeyFunction
 * DESCRIPTION
 *  Redraws the dynamic icon notification with user input screen
 * PARAMETERS
 *  f       [IN]        
 *  k       [IN]        
 * RETURNS
 *  void
 *****************************************************************************/
void SetCategory171RightSoftkeyFunction(void (*f) (void), MMI_key_event_type k)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    UI_UNUSED_PARAMETER(k);
    wgui_inputbox_RSK_function = f;
}


/* For detail description, please refer to wgui_categories_inputs.h */
void ShowCategory171Screen(
        U8 *left_softkey,
        PU8 left_softkey_icon,
        U8 *right_softkey,
        PU8 right_softkey_icon,
        U8 *message,
        PU8 message_icon,
        U32 input_type,
        U8 *buffer,
        S32 buffer_size,
        U8 *history_buffer)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    dm_data_struct dm_data;
    S32 inputbox_x, inputbox_y, inputbox_width, inputbox_height;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    UI_UNUSED_PARAMETER(history_buffer);
    gui_setup_common_layout();
#if(UI_DOUBLE_BUFFER_SUPPORT)
    gui_lock_double_buffer();
#endif 

    wgui_title_set_menu_shortcut_number(-1);
    clear_category_screen_key_handlers();
    set_left_softkey_label((UI_string_type) left_softkey);
    set_left_softkey_icon(left_softkey_icon);
    set_right_softkey_label((UI_string_type) right_softkey);
    set_right_softkey_icon(right_softkey_icon);
    clear_left_softkey();
    clear_right_softkey();
    register_left_softkey_handler();
    register_right_softkey_handler();
    register_default_hide_softkeys();
    MMI_title_string = (UI_string_type) message;
    MMI_title_icon = (PU8) message_icon;
    /* for T9 */
    inputbox_x = 0;
    inputbox_y = (MMI_title_y + MMI_title_height);
    inputbox_width = UI_device_width;
#if defined(__MMI_FULL_SCREEN_EDITOR__)
    inputbox_height = MMI_content_height - 12;
#else 
    inputbox_height = MMI_content_height - MMI_multitap_height - 12;
#endif 
    wgui_inputs_ml_setup(
        inputbox_x,
        inputbox_y,
        inputbox_width,
        inputbox_height,
        buffer,
        buffer_size,
        MMI_CATEGORY171_ID,
        (UI_string_type) right_softkey,
        (PU8) right_softkey_icon,
        input_type,
        history_buffer,
        1);

    wgui_inputs_ml_set_common_style(MMI_FALSE, MMI_TRUE);

    /* W05.41 Do not Clear Key Pound Function because it is used in some input method */
    setup_scrolling_title();

#ifdef __MMI_WALLPAPER_ON_BOTTOM__
    dm_get_scr_bg_opacity(&editor_scr_bg_opacity);
    dm_set_scr_bg_opacity((U8)(current_MMI_theme->bg_opacity_low));
#endif /* __MMI_WALLPAPER_ON_BOTTOM__ */ 

#if(UI_DOUBLE_BUFFER_SUPPORT)
    gui_unlock_double_buffer();
#endif 
    ExitCategoryFunction = ExitCategory171Screen;
    dm_setup_category_functions(dm_redraw_category_screen, dm_get_category_history, dm_get_category_history_size);
    //dm_register_category_controlled_callback(category5callback);
    dm_data.s32ScrId = (S32) GetActiveScreenId();
    dm_data.s32CatId = MMI_CATEGORY171_ID;
    dm_data.s32flags = DM_CLEAR_SCREEN_BACKGROUND | DM_SCROLL_TITLE;
    dm_data.s32flags |= DM_SHOW_VKPAD;
#if !defined(GUI_EDITOR_SHOW_TITLE)
//    dm_data.s32flags |= DM_NO_TITLE;
#endif /* !defined(GUI_EDITOR_SHOW_TITLE) */

    dm_setup_data(&dm_data);
    dm_register_vkpad_callback(mmi_imc_redraw_screen_by_state);
    dm_redraw_category_screen();
}


/*****************************************************************************
 * FUNCTION
 *  ExitCategory171Screen
 * DESCRIPTION
 *  Exits the dynamic icon notification with user input screen
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void ExitCategory171Screen(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
#if(UI_BLINKING_CURSOR_SUPPORT)
    //gui_cancel_timer(UI_inputbox_blink_cursor);
    StopTimer(BLINKING_CURSOR);

#endif /* (UI_BLINKING_CURSOR_SUPPORT) */ 
    close_scrolling_title();
    /* to reset softkeys and multitap status */
    wgui_inputs_ml_close();
    reset_softkeys();

#ifdef __MMI_WALLPAPER_ON_BOTTOM__
    dm_set_scr_bg_opacity(editor_scr_bg_opacity);
#endif /* __MMI_WALLPAPER_ON_BOTTOM__ */ 

    ExitCategoryFunction = MMI_dummy_function;
    RedrawCategoryFunction = MMI_dummy_function;
    GetCategoryHistory = dummy_get_history;
    GetCategoryHistorySize = dummy_get_history_size;
}


#if defined(__MMI_WCSS_INPUT_FORMAT_SUPPORT__)
// TODO: to be moved to wgui_categories_inputs.c

U8 *cat115buffer;

/* Return The Input Mode Respect To The Input Method Passed By User. */
mmi_imm_input_mode_enum wgui_wcss_alphabetic_uppercase_method[] = {IMM_INPUT_MODE_MULTITAP_UPPERCASE_ABC_NO_NUMERIC, IMM_INPUT_MODE_NONE};
mmi_imm_input_mode_enum wgui_wcss_alphabetic_lowercase_method[] = {IMM_INPUT_MODE_MULTITAP_LOWERCASE_ABC_NO_NUMERIC, IMM_INPUT_MODE_NONE};

/*****************************************************************************
 * FUNCTION
 *  WCSS_check_input_method
 * DESCRIPTION
 *  
 * PARAMETERS
 *  s       [?]     
 * RETURNS
 *  
 *****************************************************************************/
static U32 WCSS_check_input_method(U8 *s, mmi_imm_input_mode_enum **input_mode_array)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    switch (s[0] & 0x1F)
    {
        case IMM_INPUT_MODE_MULTITAP_UPPERCASE_ABC_NO_NUMERIC:
            *input_mode_array = wgui_wcss_alphabetic_uppercase_method;
            return (IMM_INPUT_TYPE_USER_SPECIFIC | IMM_INPUT_TYPE_EXT_ENGLISH_UPPERCASE);
        case IMM_INPUT_MODE_MULTITAP_LOWERCASE_ABC_NO_NUMERIC:
            *input_mode_array = wgui_wcss_alphabetic_lowercase_method;
            return IMM_INPUT_TYPE_USER_SPECIFIC;
        case IMM_INPUT_MODE_MULTITAP_UPPERCASE_ABC:
            return IMM_INPUT_TYPE_ENGLISH_SENTENCE_UPPERCASE;
        case IMM_INPUT_MODE_MULTITAP_LOWERCASE_ABC:
            return IMM_INPUT_TYPE_ENGLISH_SENTENCE_LOWERCASE;
        case IMM_INPUT_MODE_123:
            return IMM_INPUT_TYPE_NUMERIC;
        case IMM_INPUT_MODE_123_SYMBOLS:
            return IMM_INPUT_TYPE_NUMERIC_SYMBOL;
        default:
            return IMM_INPUT_TYPE_SENTENCE;
    }
    
}


/*****************************************************************************
 * FUNCTION
 *  RedrawCategory115Screen
 * DESCRIPTION
 *  Redraws the category115 screen
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void RedrawCategory115Screen(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    RedrawCategory5Screen();
}


/*****************************************************************************
 * FUNCTION
 *  SetCategory115RightSoftkeyFunction
 * DESCRIPTION
 *  
 * PARAMETERS
 *  f       [IN]        
 *  k       [IN]        
 * RETURNS
 *  void
 *****************************************************************************/
void SetCategory115RightSoftkeyFunction(void (*f) (void), MMI_key_event_type k)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    SetCategory5RightSoftkeyFunction(f, k);
}


/*****************************************************************************
 * FUNCTION
 *  ExitCategory115Screen
 * DESCRIPTION
 *  Exits the category5 screen
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void ExitCategory115Screen(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* Reference: ExitCategory5Screen() */
    wgui_inputs_ml_close();
    reset_softkeys();
    clear_key_input_handler();  /* Key input handler was registered before */

    ExitCategoryFunction = MMI_dummy_function;
    RedrawCategoryFunction = MMI_dummy_function;
    GetCategoryHistory = dummy_get_history;
    GetCategoryHistorySize = dummy_get_history_size;
    if (cat115buffer != NULL)
    {
        gui_free(cat115buffer);
        cat115buffer = NULL;
    }
}


/*****************************************************************************
 * FUNCTION
 *  GetCategory115HistorySize
 * DESCRIPTION
 *  Gets the size of the history buffer for category115 screen
 * PARAMETERS
 *  void
 * RETURNS
 *  size in U8s of the history buffer
 *****************************************************************************/
S32 GetCategory115HistorySize(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    return (sizeof(multiline_inputbox_category_history));
}


/*****************************************************************************
 * FUNCTION
 *  GetCategory115History
 * DESCRIPTION
 *  Gets the history buffer for category115 screen
 * PARAMETERS
 *  history_buffer      [IN]        Is the buffer into which the history data is stored (pre-allocated)
 *  buffer_size(?)      [IN]        In unicode (containing '\0')
 * RETURNS
 *  Pointer to the history buffer
 *****************************************************************************/
U8 *GetCategory115History(U8 *history_buffer)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    wgui_inputs_ml_get_category_history(MMI_CATEGORY5_ID, history_buffer);
    return (history_buffer);
}


/*****************************************************************************
 * FUNCTION
 *  ShowCategory115Screen
 * DESCRIPTION
 *  Displays the category115 screen (WCSS editor)
 * PARAMETERS
 *  title                   [IN]        Title for the screen
 *  title_icon              [IN]        Icon shown with the title
 *  left_softkey            [IN]        Left softkey label
 *  left_softkey_icon       [IN]        Icon for the left softkey
 *  right_softkey           [IN]        Right softkey label
 *  right_softkey_icon      [IN]        Icon for the right softkey
 *  buffer                  [IN]        Buffer the input box should use.
 *  buffer_size             [IN]        UCS2 character count including '\0'
 *  input_format            [IN]        WAP input-format
 *  input_required          [IN]        Unused
 *  input_type              [IN]        input type
 *  history_buffer          [IN]        History buffer
 * RETURNS
 *  void
 *****************************************************************************/
/*
 * Note: We do not handle Chinese input in ShowCategory115Screen to simplify the design.
 * * "*m" and "*M" is already handled in WAP. and "nnn*M" will only allow three digits, and 
 * * any number of western characters.
 */
void ShowCategory115Screen_ext(
        U16 title,
        U16 title_icon,
        U16 left_softkey,
        U16 left_softkey_icon,
        U16 right_softkey,
        U16 right_softkey_icon,
        U8 *buffer,
        S32 buffer_size,
        U8 *input_format,
        U8 input_required,
        U32 input_type,
        U8 *history_buffer)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    /* Reference: ShowCategory5Screen() */
    dm_data_struct dm_data;//092906 cat115
    S32 inputbox_x = 0;
    S32 inputbox_y = (MMI_title_y + MMI_title_height);
    S32 inputbox_width = MMI_content_width;

#if defined(__MMI_FULL_SCREEN_EDITOR__)
    S32 inputbox_height = MMI_content_height;
#else 
    S32 inputbox_height = MMI_content_height - MMI_multitap_height;
#endif 
    S8 input_format_status = 0;
    S32 format_length;
	mmi_imm_input_mode_enum *input_method_array = NULL;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    gui_setup_common_layout();
    
    if (buffer_size > CAT115_MAXSIZE)   /* Maximum input char = CAT115_MAXSIZE - 1 */
    {
        buffer_size = CAT115_MAXSIZE;
    }

    format_length = get_category_115_format_buffer_length(input_format, buffer_size);

    if (format_length == -1)
    {
        /* Use as normat category 5. */
        input_format_status = (S8) (-1);
    }
    else if (format_length == 0)
    {
        /* Leave buffer_size unchanged */
    }
    else if (format_length < buffer_size)
    {
        /* Set the buffer length to the upper bound derived from input format */
        buffer_size = format_length + 1;
    }
    else if (format_length >= buffer_size)
    {
        /* Act as Category 5 */
        input_format_status = (S8) (-1);
    }
    if (input_format_status != (S8)(-1))
    {
        /* Allocate fixed size of control buffer bucket because the size is controlled by
           external web pages; otherwise, it might exhaust some kind of control buffer */
        cat115buffer = gui_malloc(CAT115_MAXSIZE);
        if (gui_parse_WCSS_string
            ((U8*) input_format, (U8*) buffer, (U8*) cat115buffer, (S16) buffer_size,
             (U8) ((history_buffer || buffer[0] || buffer[1]) ? 1 : 0)) != 0)
        {
            input_format_status = (S8) (-1);    /* In this case the editor will works as normal text editor. */
        }
    }

    if (input_format_status != (S8)(-1))
    {
        extern void gui_reset_WCSS_cursor_position(void);

        /* Use INPUT_TYPE_OVERRIDE_DEFAULT to prevent overriden by default input method, which might be chinese input method (unsupported) */
        if ((input_type & INPUT_TYPE_MASK) != IMM_INPUT_TYPE_NUMERIC_PASSWORD && 
            (input_type & INPUT_TYPE_MASK) != IMM_INPUT_TYPE_ALPHANUMERIC_PASSWORD)
        {
            input_type = WCSS_check_input_method(cat115buffer, &input_method_array) /*| INPUT_TYPE_OVERRIDE_DEFAULT*/;
        }

        is_fisrt_entry_WCSS_editor = MMI_TRUE;
        gui_reset_WCSS_cursor_position();
    }

#if(UI_DOUBLE_BUFFER_SUPPORT)
    gui_lock_double_buffer();
#endif 

    wgui_title_set_menu_shortcut_number(-1);
    wgui_title_disable_menu_shortcut_display(MMI_TRUE);
    clear_category_screen_key_handlers();
    change_left_softkey(left_softkey, left_softkey_icon);
    change_right_softkey(right_softkey, right_softkey_icon);
    clear_left_softkey();
    clear_right_softkey();
    register_left_softkey_handler();
    register_right_softkey_handler();
    register_default_hide_softkeys();

    MMI_title_string = (UI_string_type) get_string(title);
    MMI_title_icon = (PU8) get_image(title_icon);

    wgui_inputs_ml_setup_ext(
        inputbox_x,
        inputbox_y,
        inputbox_width,
        inputbox_height,
        buffer,
        buffer_size,
        MMI_CATEGORY5_ID,
        get_string(right_softkey),
        get_image(right_softkey_icon),
        input_type,
        history_buffer,
        input_method_array,
        1,
        0,
        0,
        0,
        0,
        0,
        NULL);
    
    wgui_inputs_ml_set_common_style(MMI_TRUE, MMI_TRUE);

    MMI_current_input_ext_type |= INPUT_TYPE_EXT_NO_SHOW_NEW_LINE_SYMBOL;

    if (input_format_status != (S8)(-1))
    {
        /* Disable word-wrapping for WCSS editor */
        wgui_inputs_ml_set_style((UI_MULTI_LINE_INPUT_BOX_OVERWRITE_MODE |
                                  UI_MULTI_LINE_WCSS_INPUT_BOX_ENABLE |
                                  UI_MULTI_LINE_INPUT_BOX_DISABLE_WRAPPING_BY_WORD),
                                  0);
    }

#if(UI_DOUBLE_BUFFER_SUPPORT)
    gui_unlock_double_buffer();
#endif 

    if (input_format_status != (S8)(-1) && history_buffer == NULL)
    {
        /* We hope to edit from the beginning even with default input values, 
           and we just configured the input format for the first character */
        wgui_inputs_ml_move_cursor_to_start();
    }

    ExitCategoryFunction = ExitCategory115Screen;
    dm_data.s32flags = DM_CLEAR_SCREEN_BACKGROUND;
    dm_data.s32flags |= DM_SHOW_VKPAD;

#if !defined(GUI_EDITOR_SHOW_TITLE)
    dm_data.s32flags |= DM_NO_TITLE;
#endif /* !defined(GUI_EDITOR_SHOW_TITLE) */

    dm_setup_category_functions(dm_redraw_category_screen, dm_get_category_history, dm_get_category_history_size);
    //dm_register_category_controlled_callback(category5callback);
    dm_data.s32ScrId = (S32) GetActiveScreenId();
    dm_data.s32CatId = MMI_CATEGORY5_ID;
    dm_setup_data(&dm_data);
    dm_register_vkpad_callback(mmi_imc_redraw_screen_by_state);
    dm_redraw_category_screen();

}


/* For detail description, please refer to wgui_categories_inputs.h */
void ShowCategory115ScreenEx(
        U16 title,
        U16 title_icon,
        U16 left_softkey,
        U16 left_softkey_icon,
        U16 right_softkey,
        U16 right_softkey_icon,
        U8 *buffer,
        S32 buffer_size,
        S16 *predefined_pos,
        void (*cursor_move_callback)(S32 cursor_offset),
        MMI_BOOL (*change_event_handler)(gui_multi_line_input_box_change_event_enum event,U16 c),
        U32 input_type,
        U8 *history_buffer)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                                                         */
    /*----------------------------------------------------------------*/
    dm_data_struct dm_data;//092906 cat115
    S32 inputbox_x = 0;
    S32 inputbox_y = (MMI_title_y + MMI_title_height);
    S32 inputbox_width = MMI_content_width;

#if defined(__MMI_FULL_SCREEN_EDITOR__)
    S32 inputbox_height = MMI_content_height;
#else 
    S32 inputbox_height = MMI_content_height - MMI_multitap_height;
#endif 

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    gui_setup_common_layout();
    
    if (buffer_size > CAT115_MAXSIZE)   /* Maximum input char = CAT115_MAXSIZE - 1 */
    {
        buffer_size = CAT115_MAXSIZE;
    }

#if(UI_DOUBLE_BUFFER_SUPPORT)
    gui_lock_double_buffer();
#endif 

    wgui_title_set_menu_shortcut_number(-1);
    wgui_title_disable_menu_shortcut_display(MMI_TRUE);
    clear_category_screen_key_handlers();
    change_left_softkey(left_softkey, left_softkey_icon);
    change_right_softkey(right_softkey, right_softkey_icon);
    clear_left_softkey();
    clear_right_softkey();
    register_left_softkey_handler();
    register_right_softkey_handler();
    register_default_hide_softkeys();

    MMI_title_string = (UI_string_type) get_string(title);
    MMI_title_icon = (PU8) get_image(title_icon);

    wgui_inputs_ml_setup(
        inputbox_x,
        inputbox_y,
        inputbox_width,
        inputbox_height,
        buffer,
        buffer_size,
        MMI_CATEGORY5_ID,
        get_string(right_softkey),
        get_image(right_softkey_icon),
        input_type,
        history_buffer,
        1);
    MMI_current_input_ext_type |= INPUT_TYPE_EXT_NO_SHOW_NEW_LINE_SYMBOL;

    wgui_inputs_ml_set_common_style(MMI_TRUE, MMI_TRUE);

    if (predefined_pos != NULL)
    {
        /* Disable word-wrapping for WCSS editor */
        wgui_inputs_ml_set_style((UI_MULTI_LINE_INPUT_BOX_OVERWRITE_MODE |
                                  UI_MULTI_LINE_INPUT_BOX_DISABLE_WRAPPING_BY_WORD),
                                  0);
        wgui_inputs_ml_set_predefine_pos_info(predefined_pos, cursor_move_callback, change_event_handler);
    }

    if (history_buffer == NULL)
    {
        /* We hope to edit from the beginning even with default input values, 
           and we just configured the input format for the first character */
        wgui_inputs_ml_move_cursor_to_start();
    }

#if(UI_DOUBLE_BUFFER_SUPPORT)
    gui_unlock_double_buffer();
#endif 

    ExitCategoryFunction = ExitCategory115Screen;
    dm_data.s32flags = DM_CLEAR_SCREEN_BACKGROUND;
    dm_data.s32flags |= DM_SHOW_VKPAD;

#if !defined(GUI_EDITOR_SHOW_TITLE)
    dm_data.s32flags |= DM_NO_TITLE;
#endif /* !defined(GUI_EDITOR_SHOW_TITLE) */

    dm_setup_category_functions(dm_redraw_category_screen, dm_get_category_history, dm_get_category_history_size);
    //dm_register_category_controlled_callback(category5callback);
    dm_data.s32ScrId = (S32) GetActiveScreenId();
    dm_data.s32CatId = MMI_CATEGORY5_ID;
    dm_setup_data(&dm_data);
    dm_register_vkpad_callback(mmi_imc_redraw_screen_by_state);
    dm_redraw_category_screen();
}


/* For detail description, please refer to wgui_categories_inputs.h */
/*
 * Note: We do not handle Chinese input in ShowCategory115Screen to simplify the design.
 * * "*m" and "*M" is already handled in WAP. and "nnn*M" will only allow three digits, and 
 * * any number of western characters.
 */
void ShowCategory115Screen(
        U16 title,
        U16 title_icon,
        U16 left_softkey,
        U16 left_softkey_icon,
        U16 right_softkey,
        U16 right_softkey_icon,
        U8 *buffer,
        S32 buffer_size,
        U8 *input_format,
        U8 input_required,
        U8 *history_buffer)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    ShowCategory115Screen_ext(
        title,
        title_icon,
        left_softkey,
        left_softkey_icon, 
        right_softkey,
        right_softkey_icon,
        buffer,
        buffer_size,
        input_format,
        input_required,
        IMM_INPUT_TYPE_SENTENCE,
        history_buffer);
}

#endif /* defined(__MMI_WCSS_INPUT_FORMAT_SUPPORT__) */ 

#if defined(__MMI_SMART_MESSAGE_MO__) && !defined(__MMI_MESSAGES_EMS__)


/*****************************************************************************
 * FUNCTION
 *  mmi_nsm2_get_remaining_len
 * DESCRIPTION
 *  
 * PARAMETERS
 *  void
 * RETURNS
 *  
 *****************************************************************************/
S32 mmi_nsm2_get_remaining_len(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (g_nsm_msg_context.UCS2_count > 0)
    {
        if (g_nsm_msg_context.is_picmsg == TRUE)
        {
            /* 64 */
            g_nsm_msg_context.remaining_length = (MAX_PICMSG_UCS2_DCS_TEXT_LEN) + 1;
        }
        else
        {
            /* 306 */
            g_nsm_msg_context.remaining_length = (UCS2_DCS_ALLOCATED_LENGTH) + 1;
        }
    }
    else    /* No UCS Character */
    {
        if (g_nsm_msg_context.is_picmsg == TRUE)
        {
            /* 128 */
            g_nsm_msg_context.remaining_length = (MAX_PICMSG_DEFAULT_DCS_TEXT_LEN) + 1;
        }
        else
        {
            /* 612 */
            g_nsm_msg_context.remaining_length = (DEFAULT_DCS_ALLOCATED_LENGTH) + 1;
        }
    }

    return (g_nsm_msg_context.remaining_length * 2);
}
#endif /* defined(__MMI_SMART_MESSAGE_MO__) && !defined(__MMI_MESSAGES_EMS__) */ 



/*****************************************************************************
 * FUNCTION
 *  SetCategory28RightSoftkeyFunction
 * DESCRIPTION
 *  
 * PARAMETERS
 *  f       [IN]        
 *  k       [IN]        
 * RETURNS
 *  void
 *****************************************************************************/
void SetCategory28RightSoftkeyFunction(void (*f) (void), MMI_key_event_type k)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    UI_UNUSED_PARAMETER(k);
    category28_RSK_function = f;
}


/*****************************************************************************
 * FUNCTION
 *  handle_category28_right_softkey_down
 * DESCRIPTION
 *  
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void handle_category28_right_softkey_down(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
#if(UI_DISABLE_EMS_INPUT_BOX)
    if (!wgui_inputs_ml_is_empty())
    {
        wgui_inputs_ml_delete_character();
    }
#else /* (UI_DISABLE_EMS_INPUT_BOX) */ 
    if (!gui_EMS_inputbox_empty(&MMI_EMS_inputbox))
    {
        EMS_inputbox_backspace();
    }
#endif /* (UI_DISABLE_EMS_INPUT_BOX) */ 
}


/*****************************************************************************
 * FUNCTION
 *  handle_category28_right_softkey_up
 * DESCRIPTION
 *  
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void handle_category28_right_softkey_up(void)
{
#if(UI_DISABLE_EMS_INPUT_BOX)
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if ((wgui_inputs_ml_is_empty()) && (!category28_RSK_label_clear))
    {
        if (category28_RSK_function != NULL)
        {
            category28_RSK_function();
        }
    }
#else /* (UI_DISABLE_EMS_INPUT_BOX) */ 
    if (category28_RSK_function != NULL)
    {
        category28_RSK_function();
    }
#endif /* (UI_DISABLE_EMS_INPUT_BOX) */ 
}


/*****************************************************************************
 * FUNCTION
 *  register_category28_handle_right_softkey_up
 * DESCRIPTION
 *  
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void register_category28_handle_right_softkey_up(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    set_right_softkey_function(handle_category28_right_softkey_up, KEY_EVENT_UP);
}


/*****************************************************************************
 * FUNCTION
 *  register_category28_handle_clear_key_up
 * DESCRIPTION
 *  
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void register_category28_handle_clear_key_up(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    SetKeyHandler(handle_category28_right_softkey_up, KEY_CLEAR, KEY_EVENT_UP);
}


/*****************************************************************************
 * FUNCTION
 *  handle_category28_right_softkey_long_press
 * DESCRIPTION
 *  
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void handle_category28_right_softkey_long_press(void)
{
#if(UI_DISABLE_EMS_INPUT_BOX)
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
#ifndef __MMI_EDITOR_QUICK_DEL_NAV__
    wgui_inputs_ml_delete_all_characters();
#else /* __MMI_EDITOR_QUICK_DEL_NAV__ */
    g_wgui_inputs_repeat_count = 0;
    set_right_softkey_function(wgui_inputs_ml_handle_right_softkey_touch_repeat, KEY_REPEAT);
    SetKeyHandler(wgui_inputs_ml_handle_right_softkey_repeat, KEY_RSK, KEY_REPEAT);
#endif /* __MMI_EDITOR_QUICK_DEL_NAV__ */

#else /* (UI_DISABLE_EMS_INPUT_BOX) */

#ifndef __MMI_EDITOR_QUICK_DEL_NAV__
    EMS_inputbox_delete_all();
#else /* (UI_DISABLE_EMS_INPUT_BOX) */
    g_wgui_inputs_repeat_count = 0;
    set_right_softkey_function(wgui_inputs_EMS_handle_right_softkey_touch_repeat, KEY_REPEAT);
    SetKeyHandler(wgui_inputs_EMS_handle_right_softkey_repeat, KEY_RSK, KEY_REPEAT);
#endif /* (UI_DISABLE_EMS_INPUT_BOX) */

#endif /* (UI_DISABLE_EMS_INPUT_BOX) */ 
}


/*****************************************************************************
 * FUNCTION
 *  handle_category28_input
 * DESCRIPTION
 *  
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void handle_category28_input(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    EMS_inputbox_has_changed = 1;
#if(UI_DISABLE_EMS_INPUT_BOX)
    if (!wgui_inputs_ml_is_empty())
    {
    #if defined(__MMI_WITH_C_KEY__)

    #else /* defined(__MMI_WITH_C_KEY__) */ 
        if (category28_RSK_label_clear == 0)
        {
            set_right_softkey_label((UI_string_type) get_string(STR_GLOBAL_CLEAR));
            set_right_softkey_icon(NULL);
            redraw_right_softkey();
            category28_RSK_label_clear = 1;
            set_right_softkey_function(UI_dummy_function, KEY_EVENT_UP);
        }
    #endif /* defined(__MMI_WITH_C_KEY__) */ 
    }
    else
    {
    #if defined(__MMI_WITH_C_KEY__)
    #else /* defined(__MMI_WITH_C_KEY__) */ 
        if (category28_RSK_label_clear == 1)
        {
            set_right_softkey_label(category28_RSK_label_string);
            set_right_softkey_icon(category28_RSK_label_icon);
            redraw_right_softkey();
            category28_RSK_label_clear = 0;
            set_right_softkey_function(register_category28_handle_right_softkey_up, KEY_EVENT_DOWN);
        }
    #endif /* defined(__MMI_WITH_C_KEY__) */ 
    }
#else /* (UI_DISABLE_EMS_INPUT_BOX) */ 
    if (MMI_EMS_inputbox.data == NULL)
    {
        return;
    }
    if (!gui_EMS_inputbox_empty(&MMI_EMS_inputbox))
    {
    #if defined(__MMI_WITH_C_KEY__)
        if (category28_RSK_label_clear == 0)
        {
            category28_RSK_label_clear = 1;
            SetKeyHandler(handle_category28_right_softkey_down, KEY_CLEAR, KEY_EVENT_DOWN);
            SetKeyHandler(handle_category28_right_softkey_down, KEY_CLEAR, KEY_REPEAT);
            SetKeyHandler(UI_dummy_function, KEY_CLEAR, KEY_EVENT_UP);
            SetKeyHandler(handle_category28_right_softkey_long_press, KEY_CLEAR, KEY_LONG_PRESS);
        }
    #else /* defined(__MMI_WITH_C_KEY__) */ 
        if (category28_RSK_label_clear == 0)
        {
            set_right_softkey_label((UI_string_type) get_string(STR_GLOBAL_CLEAR));
            set_right_softkey_icon(NULL);
            redraw_right_softkey();
            category28_RSK_label_clear = 1;
            set_right_softkey_function(handle_category28_right_softkey_down, KEY_EVENT_DOWN);
            set_right_softkey_function(handle_category28_right_softkey_long_press, KEY_LONG_PRESS);
            set_right_softkey_function(UI_dummy_function, KEY_EVENT_UP);
        }
    #endif /* defined(__MMI_WITH_C_KEY__) */ 

    }
    else
    {
    #if defined(__MMI_WITH_C_KEY__)
        if (category28_RSK_label_clear == 1)
        {
            category28_RSK_label_clear = 0;
            SetKeyHandler(UI_dummy_function, KEY_CLEAR, KEY_EVENT_DOWN);
            SetKeyHandler(UI_dummy_function, KEY_CLEAR, KEY_REPEAT);
            SetKeyHandler(register_category28_handle_clear_key_up, KEY_CLEAR, KEY_EVENT_UP);
            SetKeyHandler(UI_dummy_function, KEY_CLEAR, KEY_LONG_PRESS);
        }
    #else /* defined(__MMI_WITH_C_KEY__) */ 
        if (category28_RSK_label_clear == 1)
        {
            set_right_softkey_label(category28_RSK_label_string);
            set_right_softkey_icon(category28_RSK_label_icon);
            redraw_right_softkey();
            category28_RSK_label_clear = 0;
            set_right_softkey_function(register_category28_handle_right_softkey_up, KEY_EVENT_DOWN);
        }
        else
        {
            set_right_softkey_label(category28_RSK_label_string);
            set_right_softkey_icon(category28_RSK_label_icon);
            redraw_right_softkey();
        }
    #endif /* defined(__MMI_WITH_C_KEY__) */ 

    }
#endif /* (UI_DISABLE_EMS_INPUT_BOX) */ 
}


/*****************************************************************************
 * FUNCTION
 *  RedrawCategory28Screen
 * DESCRIPTION
 *  
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void RedrawCategory28Screen(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    gui_lock_double_buffer();

    clear_screen();

    show_title_status_icon();
    draw_title();
#if(UI_DISABLE_EMS_INPUT_BOX)
    wgui_inputs_ml_show();
#else 
    show_EMS_inputbox();
#endif 
    wgui_EMS_redraw_input_information_bar();
#if defined(__MMI_VIRTUAL_KEYBOARD__)
    wgui_show_virtual_keyboard();
#endif 
    show_softkey_background();
    show_left_softkey();
    show_right_softkey();
    gui_unlock_double_buffer();
    gui_BLT_double_buffer(0, 0, UI_device_width - 1, UI_device_height - 1);
    /* for redrawing spelling or candidate boxes */
    if (RedrawSpellingOrCandidateBoxesFunction)
    {
        RedrawSpellingOrCandidateBoxesFunction();
    }
}


/*****************************************************************************
 * FUNCTION
 *  cat28_virtual_keypad_callback
 * DESCRIPTION
 *  
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void cat28_virtual_keypad_callback(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
#if defined(__MMI_TOUCH_SCREEN__)
    mmi_imc_redraw_screen_by_state();
#endif 
}


/*****************************************************************************
 * FUNCTION
 *  category28callback
 * DESCRIPTION
 *  
 * PARAMETERS
 *  coordinate      [?]     
 * RETURNS
 *  void
 *****************************************************************************/
void category28callback(dm_coordinates *coordinate)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (RedrawSpellingOrCandidateBoxesFunction)
    {
        RedrawSpellingOrCandidateBoxesFunction();
    }
}


/*****************************************************************************
 * FUNCTION
 *  AppendCategory28String
 * DESCRIPTION
 *  
 * PARAMETERS
 *  input_type          [IN]        
 *  data                [?]         
 *  s                   [?]         
 *  history_buffer      [?]         
 * RETURNS
 *  
 *****************************************************************************/
U8 AppendCategory28String(U32 input_type, EMSData *data, U8 *s, U8 *history_buffer)
{
#if(!UI_DISABLE_EMS_INPUT_BOX)
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    S32 success = 1;
#ifdef __MMI_MENUTREE_2__
    S32 j = 0;
#endif 
    S32 l, box_height;
    U8 h;
    mmi_imc_history temp_ime_history;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/

#ifdef __MMI_INDIC_ALG__
    add_template_ems_flag=1;
#endif /* __MMI_INDIC_ALG__ */


#if(UI_DOUBLE_BUFFER_SUPPORT)
    gui_lock_double_buffer();
#endif 
    l = gui_strlen((UI_string_type) s);
    box_height = MMI_content_height - MMI_multitap_height - 10;
    gui_create_EMS_input_box(&MMI_EMS_inputbox, 0, (MMI_title_y + MMI_title_height) + 12, UI_device_width, box_height);
    gui_set_EMS_input_box_data(&MMI_EMS_inputbox, data);

    memcpy(&temp_ime_history, &(((EMS_inputbox_category_history*)history_buffer)->ime_history), sizeof(mmi_imc_history));

    h = set_EMS_inputbox_category_history(MMI_CATEGORY28_ID, history_buffer);
    if (h)
    {
        gui_EMS_input_box_locate_cursor(&MMI_EMS_inputbox);
    #ifdef __MMI_MESSAGES_EMS__
        gui_EMS_input_box_set_text_format_object(&MMI_EMS_inputbox, &wgui_EMS_text_format);
    #endif 
    }
    MMI_EMS_inputbox.flags |= UI_EMS_INPUT_BOX_DISABLE_DRAW;
    gui_show_EMS_input_box(&MMI_EMS_inputbox);
    MMI_EMS_inputbox.flags &= ~UI_EMS_INPUT_BOX_DISABLE_DRAW;

    if (gui_EMS_input_box_add_whole_string(&MMI_EMS_inputbox, s, &MMI_EMS_inputbox.text_format) != EMS_OK)
    {
        success = 0;
    }
    

#ifdef __MMI_INDIC_ALG__
	/*This function call is to reset the offset of the objects after the  */
    /*the template has been added                                         */      
    gui_EMS_post_template_addition_adjustment(&MMI_EMS_inputbox);
	gui_EMS_input_box_locate_cursor(&MMI_EMS_inputbox);
    add_template_ems_flag=0;
#endif /* __MMI_INDIC_ALG__ */

    get_EMS_inputbox_category_history(MMI_CATEGORY28_ID, history_buffer);

    memcpy(&(((EMS_inputbox_category_history*)history_buffer)->ime_history), &temp_ime_history, sizeof(mmi_imc_history));

#if(UI_DOUBLE_BUFFER_SUPPORT)
    gui_unlock_double_buffer();
#endif 
    if (success)
    {
        return (1);
    }
    else
    {
        return (0);
    }
#else /* (!UI_DISABLE_EMS_INPUT_BOX) */ 
    UI_UNUSED_PARAMETER(input_type);
    UI_UNUSED_PARAMETER(data);
    UI_UNUSED_PARAMETER(s);
    UI_UNUSED_PARAMETER(history_buffer);
    return (0);
#endif /* (!UI_DISABLE_EMS_INPUT_BOX) */ 
}


/* For detail description, please refer to wgui_categories_inputs.h */
void ShowCategory28Screen(
        U16 title,
        U16 title_icon,
        U16 left_softkey,
        U16 left_softkey_icon,
        U16 right_softkey,
        U16 right_softkey_icon,
        EMSData *data,
        U8 *history_buffer)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
#if defined __MMI_LANG_HINDI__ && defined __MMI_BIDI_ALG__
    U16 unicode = 0;
    U16 clFill = 0;
#endif /*__MMI_BIDI_ALG__ */


    dm_data_struct dm_data;

#if(UI_DISABLE_EMS_INPUT_BOX)
    S32 length;
    S32 i, j, h, fh;

    UI_UNUSED_PARAMETER(history_buffer);
#else /* (UI_DISABLE_EMS_INPUT_BOX) */ 
    U8 h;
    S32 box_height;
#endif /* (UI_DISABLE_EMS_INPUT_BOX) */ 

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    gdi_layer_lock_frame_buffer();
    gui_setup_common_layout();
    wgui_inputs_set_current_input_box_type(EDITOR_EMS_INPUT_BOX);

    wgui_inputbox_information_flag = 1;
    wgui_inputbox_information_bar_height = INFORMATION_BAR_HEIGHT;
    wgui_EMS_setup_input_information(
        0,
        (MMI_title_y + MMI_title_height),
        UI_device_width,
        wgui_inputbox_information_bar_height);
    wgui_title_set_menu_shortcut_number(-1);
    change_left_softkey(left_softkey, left_softkey_icon);
    change_right_softkey(right_softkey, right_softkey_icon);
    SetupCategoryKeyHandlers();

    MMI_title_string = (UI_string_type) get_string(title);
    MMI_title_icon = (PU8) get_image(title_icon);

#if(UI_DISABLE_EMS_INPUT_BOX)
    length = (data->textBufferSize >> 1);
    if (length == 0)
    {
        UI_string_type s = (UI_string_type) "EMS Data not initialized";
        S32 l = gui_strlen((UI_string_type) s);

        temp_EMS_buffer = (UI_string_type) gui_malloc(l * sizeof(UI_character_type));
        gui_strcpy((UI_string_type) temp_EMS_buffer, (UI_string_type) s);
        length = l + 1;
        i = j = l;
    }
    else
    {
        temp_EMS_buffer = (UI_string_type) gui_malloc(length * sizeof(UI_character_type));
        i = j = 0;
        while (j < data->textLength)
        {
            if ((data->textBuffer[j] == '\0') && (data->textBuffer[j + 1] == '\0'))
            {
                temp_EMS_buffer[i] = '\0';
                break;
            }
            else
            {
                temp_EMS_buffer[i] = data->textBuffer[j + 1];
            }
            i++;
            j += 2;
        }
    }
    temp_EMS_data = data;
    wgui_inputs_ml_create_set_buffer(temp_EMS_buffer, length, i, 0);
    wgui_inputs_ml_register_keys();
    h = MMI_content_height - MMI_multitap_height - 8;
    gui_set_font(MMI_multiline_inputbox.text_font);
    fh = gui_get_character_height();
    h = ((h / fh) * fh) + 8;
    wgui_inputs_ml_resize(WGUI_INPUTS_STYLE_DEFAULT, h);
    wgui_inputs_ml_set_mask(0);

    set_right_softkey_function(handle_category28_right_softkey_down, KEY_EVENT_DOWN);
    set_right_softkey_function(handle_category28_right_softkey_long_press, KEY_LONG_PRESS);
    wgui_inputs_ml_register_input_callback(handle_category28_input);
    category28_RSK_label_icon = get_image(right_softkey_icon);
    category28_RSK_label_string = get_string(right_softkey);
    handle_category28_input();
    if (wgui_inputs_ml_is_empty())
    {
        set_right_softkey_function(handle_category28_right_softkey_up, KEY_EVENT_UP);
    }

#ifdef __MMI_WALLPAPER_ON_BOTTOM__
    MMI_EMS_inputbox.flags |= UI_EMS_INPUT_BOX_TRANSPARENT_BACKGROUND;
    dm_get_scr_bg_opacity(&editor_scr_bg_opacity);
    dm_set_scr_bg_opacity((U8)(current_MMI_theme->bg_opacity_low));
#endif /* __MMI_WALLPAPER_ON_BOTTOM__ */ 

#else /* (UI_DISABLE_EMS_INPUT_BOX) */ 

#if((UI_ENABLE_FRAME_SKIPPING) && (ENABLE_EMS_INPUTBOX_FRAME_SKIPPING))
    wgui_EMS_inputbox_frame_counter = 0;
#endif 
#ifdef __MMI_MESSAGES_EMS__
    initialize_EMS_objects();
#endif 
    /* adjust to avoid overlap with multitap window */
#if defined(__MMI_FULL_SCREEN_EDITOR__)
    box_height = MMI_content_height - 13;
#else 
    box_height = MMI_content_height - MMI_multitap_height - 13;
#endif 
    register_EMS_inputbox_input_callback(UI_dummy_function);

    gui_create_EMS_input_box(
        &MMI_EMS_inputbox,
        0,
        (MMI_title_y + MMI_title_height) + wgui_EMS_inputbox_information_bar_height,
        UI_device_width,
        box_height);
    gui_set_EMS_input_box_data(&MMI_EMS_inputbox, data);
    h = set_EMS_inputbox_category_history(MMI_CATEGORY28_ID, history_buffer);
    if (h)
    {   /* Current alignment is not saved in history, so test it using a flag   */
        if (EMS_inputbox_alignment_added_flag)
        {
            wgui_EMS_text_format.Alignment = EMS_inputbox_alignment;
            MMI_EMS_inputbox.text_format.Alignment = EMS_inputbox_alignment;
            EMS_inputbox_alignment_added_flag = 0;
        }
    #ifdef __MMI_MESSAGES_EMS__
        gui_EMS_input_box_set_text_format_object(&MMI_EMS_inputbox, &wgui_EMS_text_format);
    #endif 
    }
    else
    {
        gui_EMS_input_box_set_text_format_cursor_position(&MMI_EMS_inputbox);
        wgui_EMS_text_format = MMI_EMS_inputbox.text_format;
    }
    gui_EMS_input_box_locate_cursor(&MMI_EMS_inputbox);
    /* Switch IME by long press # */

    register_EMS_inputbox_keys();
    set_right_softkey_function(handle_category28_right_softkey_down, KEY_EVENT_DOWN);
    set_right_softkey_function(handle_category28_right_softkey_long_press, KEY_LONG_PRESS);

#ifdef __MMI_WALLPAPER_ON_BOTTOM__
    MMI_EMS_inputbox.flags |= UI_EMS_INPUT_BOX_TRANSPARENT_BACKGROUND;
    dm_get_scr_bg_opacity(&editor_scr_bg_opacity);
    dm_set_scr_bg_opacity((U8)(current_MMI_theme->bg_opacity_low));
#endif /* __MMI_WALLPAPER_ON_BOTTOM__ */ 

    wgui_EMS_inputbox_information_icon = NULL;

    category28_RSK_label_icon = get_image(right_softkey_icon);
    category28_RSK_label_string = get_string(right_softkey);

#if(EMS_USE_INTERNAL_MENU)
    SetKeyHandler(EntryEMSMainMenu, KEY_SEND, KEY_EVENT_UP);
#endif 

    if (h)
    {
        mmi_imc_set_input_method_history(&(((EMS_inputbox_category_history*)history_buffer)->ime_history));
    }

    mmi_imm_set_required_mode_list(IMM_INPUT_TYPE_SENTENCE, NULL, IMM_INPUT_MODE_NONE);
    g_mmi_editor_hanler.input_box_type = MMI_EDITOR_EMS_INPUT_BOX;
    g_mmi_editor_hanler.input_box_sub_type = MMI_EDITOR_NORMAL_INPUT_BOX;
    g_mmi_editor_hanler.input_box_handler = &MMI_EMS_inputbox;
    mmi_imc_connect((void *)&g_mmi_editor_hanler, mmi_input_box_msg_call_back_ems);
    
#endif /* (UI_DISABLE_EMS_INPUT_BOX) */ 

    wgui_set_EMS_inputbox_RSK();

    gui_unlock_double_buffer();

    ExitCategoryFunction = ExitCategory28Screen;
    dm_setup_category_functions(dm_redraw_category_screen, dm_get_category_history, dm_get_category_history_size);
    dm_register_category_controlled_callback(category28callback);
    dm_data.s32ScrId = (S32) GetActiveScreenId();
    dm_data.s32CatId = MMI_CATEGORY28_ID;
    dm_data.s32flags = DM_CLEAR_SCREEN_BACKGROUND;
    dm_data.s32flags |= DM_SHOW_VKPAD;
#if !defined(GUI_EDITOR_SHOW_TITLE)
    dm_data.s32flags |= DM_NO_TITLE;
#endif /* !defined(GUI_EDITOR_SHOW_TITLE) */
#if defined(MBM_IMIBASE_SUPPORT)
    if(mbm_is_input_screen())
    {
        mmi_imm_input_mode_enum current_input_type = mbm_get_system_current_input_type();
        
        if (mmi_imm_is_curr_allow_input_mode(current_input_type))
        {
            while (mmi_imm_get_curr_input_mode() != current_input_type)
            {
                 if (!mmi_imc_change_input_mode(mmi_imm_get_next_mode(), 0))
                    break;
            }
        }
    }
#endif //MBM_IMIBASE_SUPPORT

    dm_setup_data(&dm_data);
    dm_register_vkpad_callback(cat28_virtual_keypad_callback);

    dm_redraw_category_screen();
    
}


/*****************************************************************************
 * FUNCTION
 *  mmi_input_box_msg_call_back_ems
 * DESCRIPTION
 *  
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
U32 mmi_input_box_msg_call_back_ems(void * input_box_handle, mmi_imc_message_struct_p msg_ptr)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
#if defined(__MMI_TOUCH_SCREEN__)
    gui_EMS_input_box_pen_enum EMS_input_box_event = 0;
	static EMSPosition    pen_down_current_position;
	static MMI_BOOL position_reserved = MMI_FALSE;
#endif 
    UI_EMS_input_box * editor_ptr;
    MMI_BOOL ret = MMI_FALSE;
    S32 i, str_len, total_len = 0;
    U32 lresult = 0;
    UI_string_type temp_str;
    UI_character_type ch;    
    U32 old_show_action_flag;
#ifdef __MMI_CLIPBOARD__
    EMSPosition cut_cursor_p,temp_position;
    U32 cursor_move_old_flags;
    U8 pre_obj;
    UI_character_type c;
    EMSObject *obj;
    U32 highlight_count = 0;
#endif /* __MMI_CLIPBOARD__ */
    
#ifdef __UI_EMS_HIGHLIGHT_LIST_SUPPORT__
    static MMI_BOOL pen_down_clipboard_state = MMI_FALSE;
#endif /* __UI_EMS_HIGHLIGHT_LIST_SUPPORT__ */
    static MMI_BOOL enable_editor_show = MMI_TRUE;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    editor_ptr = (UI_EMS_input_box *)((mmi_editor_handler_struct *)input_box_handle)->input_box_handler;
    
    MMI_ASSERT(editor_ptr == &MMI_EMS_inputbox);

    switch (msg_ptr->message_id)
    {
    case MMI_IMC_MESSAGE_INSERT_CHAR:
        
        lresult = EMS_inputbox_direct_input((UI_character_type)msg_ptr->param_0);

            break;
        
    case MMI_IMC_MESSAGE_INSERT_STRING:
        
        temp_str = (UI_string_type)msg_ptr->param_0;
        
        str_len = (S32)mmi_ucs2strlen((const S8 *)temp_str);

        old_show_action_flag = editor_ptr->show_action_flag;
                
        editor_ptr->show_action_flag = 0;
        
        for (i = 0; i < str_len; i++)
        {
            /* TODO: Insert successfully? */
            if (EMS_inputbox_direct_input_no_draw((UI_character_type)temp_str[i]))
            {
                total_len ++;
            }
            else
            {
                break;
            }
        }
        
        editor_ptr->show_action_flag = old_show_action_flag;
		
		gui_EMS_input_box_locate_cursor(editor_ptr);
        
#ifdef GUI_INPUT_BOX_CACHE_SUPPORT
        if (str_len > 10)
        {
            gui_emsc_all_line_update();
        }
#endif
        if (enable_editor_show)
        {
            redraw_EMS_inputbox();
        }

        EMS_inputbox_input_callback();
        
        lresult = total_len;
        
            break;
        case MMI_IMC_MESSAGE_INSERT_STRING_NO_DRAW:

            temp_str = (UI_string_type)msg_ptr->param_0;

            str_len = (S32)mmi_ucs2strlen((const S8 *)temp_str);

            for (i = 0; i < str_len; i++)
            {
                /* TODO: Insert successfully? */
                if (EMS_inputbox_direct_input_no_draw((UI_character_type)temp_str[i]))
                {
                    total_len ++;
                }
                else
                {
                    break;
                }
            }
            EMS_inputbox_input_callback();

            lresult = total_len;
            break;
        
	case MMI_IMC_MESSAGE_REPLACE_HIGHLIGHT_STRING:

		old_show_action_flag = editor_ptr->show_action_flag;
		
        editor_ptr->show_action_flag = 0;

		for (i = 0; i < msg_ptr->param_0; i ++)
        {
            EMS_inputbox_backspace_no_draw();
        }

		temp_str = (UI_string_type)msg_ptr->param_1;
        
        str_len = (S32)mmi_ucs2strlen((const S8 *)temp_str);
		
        for (i = 0; i < str_len; i++)
        {
            /* TODO: Insert successfully? */
            if (EMS_inputbox_direct_input_no_draw((UI_character_type)temp_str[i]))
            {
                total_len ++;
            }
            else
            {
                break;
            }
        }

		if (total_len)
		{
            gui_EMS_input_box_highlight_cursor_number(editor_ptr, (S32)total_len);
		}

        else
        {
            /* if no character gets inserted , no character will be highlighted*/
            editor_ptr->flags &= ~UI_EMS_INPUT_BOX_WORD_HIGHLIGHT;
            memset(&editor_ptr->highlight_start_position, 0, sizeof(EMSPosition));
            memset(&editor_ptr->highlight_end_position, 0, sizeof(EMSPosition));
        }

		editor_ptr->show_action_flag = old_show_action_flag;
		
		gui_EMS_input_box_locate_cursor(editor_ptr);
        
        if (enable_editor_show)
        {
            redraw_EMS_inputbox();
        }

        EMS_inputbox_input_callback();
        
        lresult = total_len;

		break;

    case MMI_IMC_MESSAGE_INSERT_PAIRED_SYMBOLS:
        temp_str = (UI_string_type)msg_ptr->param_0;
        
        str_len = (S32)mmi_ucs2strlen((const S8 *)temp_str);
        
        old_show_action_flag = editor_ptr->show_action_flag;
        
        editor_ptr->show_action_flag = 0;
        
        for (i = 0; i < str_len; i++)
        {
            /* TODO: Insert successfully? */
            if (EMS_inputbox_direct_input_no_draw((UI_character_type)temp_str[i]))
            {
                total_len ++;
            }
            else
            {
                break;
            }
        }
        
        editor_ptr->show_action_flag = old_show_action_flag;
        
        gui_EMS_input_box_locate_cursor(editor_ptr);
        
        if (enable_editor_show)
        {
            redraw_EMS_inputbox();
        }

        EMS_inputbox_input_callback();

        if (total_len == str_len)
        {
            EMS_inputbox_previous();
            lresult = MMI_TRUE;
        }
        else
        {
            lresult = MMI_FALSE;
        }    
        
        break;
    
	case MMI_IMC_MESSAGE_GET_HIGHLIGHT_WORD:
        if (editor_ptr->flags & UI_EMS_INPUT_BOX_WORD_HIGHLIGHT)
        {
            *((UI_buffer_type *)(msg_ptr->param_0)) = MMI_EMS_inputbox.data->textBuffer + MMI_EMS_inputbox.highlight_start_position.OffsetToText;
            *((UI_buffer_type *)(msg_ptr->param_1)) = MMI_EMS_inputbox.data->textBuffer + MMI_EMS_inputbox.highlight_end_position.OffsetToText;
            lresult = (U32)((MMI_EMS_inputbox.highlight_end_position.OffsetToText - MMI_EMS_inputbox.highlight_start_position.OffsetToText) / ENCODING_LENGTH);
        }
        else
        {
            *((UI_buffer_type *)(msg_ptr->param_0)) = 0;
            *((UI_buffer_type *)(msg_ptr->param_1)) = 0;
            lresult = 0;
        }
        break;
		
    case MMI_IMC_MESSAGE_DELETE_STRING:
        old_show_action_flag = MMI_EMS_inputbox.show_action_flag;
        MMI_EMS_inputbox.show_action_flag = 0;

        for (i = 0; i < msg_ptr->param_0; i ++)
        {
            EMS_inputbox_backspace_no_draw();
        }
        
        MMI_EMS_inputbox.show_action_flag = old_show_action_flag;
        gui_EMS_input_box_locate_cursor(&MMI_EMS_inputbox);
        
        if (!msg_ptr->param_1)
        {
            if (enable_editor_show)
            {
                redraw_EMS_inputbox();
            }
        }
        
        EMS_inputbox_input_callback();
            break;
        
    case MMI_IMC_MESSAGE_CHANGE_TO_INITIAL:
            break;
        
    case MMI_IMC_MESSAGE_INSERT_MULTITAP_CHAR:
        ch = (UI_character_type)msg_ptr->param_0;
        lresult = EMS_inputbox_multitap_input_no_draw(ch);
        if (enable_editor_show)
        {
            redraw_EMS_inputbox();
        }

        if(lresult == MMI_TRUE) lresult = 1;
            break;

	case MMI_IMC_MESSAGE_INSERT_MULTITAP_STRING:
        temp_str = (UI_string_type)msg_ptr->param_0;
        /* Insert the string in editor */
        lresult = EMS_inputbox_multitap_input_string((PU8)temp_str);
	        break;

    case MMI_IMC_MESSAGE_RESET_MULTITAP_STATE:
        EMS_inputbox_multitap_input_complete_no_draw();
        if (enable_editor_show)
        {
            redraw_EMS_inputbox();
        }
        gui_ems_input_box_stop_input(editor_ptr);
            break;

    case MMI_IMC_MESSAGE_DELETE_CHAR:

        for (i = 0; i < msg_ptr->param_0; i++)
        {
            EMS_inputbox_backspace_no_draw();
        }
        if (enable_editor_show)
        {
            redraw_EMS_inputbox();
        }
        EMS_inputbox_input_callback();

            break;

    case MMI_IMC_MESSAGE_CLEAR_ALL:
        EMS_inputbox_delete_all();

            break;
        
    case MMI_IMC_MESSAGE_MOVE_CURSOR:
        switch (msg_ptr->param_0)
        {
            case MMI_IMC_EDITOR_CURSOR_UP:
                for (i = 0; i <(S32)msg_ptr->param_1; i ++)
                {
                    EMS_inputbox_previous_line();
                }
            break;
            case MMI_IMC_EDITOR_CURSOR_DOWN:
                for (i = 0; i <(S32)msg_ptr->param_1; i ++)
                {
                    EMS_inputbox_next_line();
                }
            break;
            case MMI_IMC_EDITOR_CURSOR_LEFT:
                for (i = 0; i <(S32)msg_ptr->param_1; i ++)
                {
                    EMS_inputbox_previous();
                }
            break;
            case MMI_IMC_EDITOR_CURSOR_RIGHT:
                for (i = 0; i <(S32)msg_ptr->param_1; i ++)
                {
                    EMS_inputbox_next();
                }
            break;
        }
        break;
    	case MMI_IMC_MESSAGE_IS_THERE_CURSOR:
        if (editor_ptr->flags & UI_EMS_INPUT_BOX_VIEW_MODE)
        {
            lresult = MMI_FALSE;
        }
        else
        {
            lresult = MMI_TRUE;
        }
            break;
    case MMI_IMC_MESSAGE_HILIGHT_BFCURSOR:
        gui_EMS_input_box_highlight_cursor_number(editor_ptr, (S32)msg_ptr->param_0);

        if (enable_editor_show)
        {
            redraw_EMS_inputbox();
        }
            break;
    case MMI_IMC_MESSAGE_CLEAR_HILIGHT:
        editor_ptr->flags &= ~UI_EMS_INPUT_BOX_WORD_HIGHLIGHT;
        memset(&editor_ptr->highlight_start_position, 0, sizeof(EMSPosition));
        memset(&editor_ptr->highlight_end_position, 0, sizeof(EMSPosition));
            break;
    case MMI_IMC_MESSAGE_GET_INPUT_BOX_RECT:
        ((mmi_imc_rect_p)msg_ptr->param_0)->x = editor_ptr->x;
        ((mmi_imc_rect_p)msg_ptr->param_0)->y = editor_ptr->y;
        ((mmi_imc_rect_p)msg_ptr->param_0)->width = editor_ptr->width;
        ((mmi_imc_rect_p)msg_ptr->param_0)->height = editor_ptr->height;
            break;
       
    case MMI_IMC_MESSAGE_RESIZE:
        if (msg_ptr->param_0 != MMI_EMS_inputbox.width || msg_ptr->param_1 != MMI_EMS_inputbox.height)
            resize_EMS_inputbox((S32)msg_ptr->param_0, (S32)msg_ptr->param_1);
            break;
    case MMI_IMC_MESSAGE_REDRAW:
        if (enable_editor_show)
        {
            redraw_EMS_inputbox();
        }
        break;
        
    case MMI_IMC_MESSAGE_CONFIG_EDITOR_SHOW:
        enable_editor_show = (MMI_BOOL)msg_ptr->param_0;
        break;

    case MMI_IMC_MESSAGE_DRAW_INFORMATION_BAR:
        wgui_EMS_redraw_input_information_bar();	
        break;
    case MMI_IMC_MESSAGE_STOP_SMART_ALPHABETIC:
        gui_ems_input_box_stop_input(editor_ptr);
        break;
    case MMI_IMC_MESSAGE_START_SMART_ALPHABETIC:
        gui_ems_input_box_start_input(editor_ptr);
        break;
    case MMI_IMC_MESSAGE_UPDATE_SOFTKEY:
        break;
    case MMI_IMC_MESSAGE_KEY_EVENT:
        break;
    case MMI_IMC_MESSAGE_MODE_CHANGED:
        break;
#if defined(__MMI_TOUCH_SCREEN__)

    case MMI_IMC_MESSAGE_GET_HANDWRITING_RECT:
        if (r2lMMIFlag)
        {
            ((mmi_imc_rect_p)msg_ptr->param_0)->x = editor_ptr->x + editor_ptr->vbar.width;
        }
        else
        {
            ((mmi_imc_rect_p)msg_ptr->param_0)->x = editor_ptr->x;
        }
        
        ((mmi_imc_rect_p)msg_ptr->param_0)->y = editor_ptr->y;
        ((mmi_imc_rect_p)msg_ptr->param_0)->width = editor_ptr->width - editor_ptr->vbar.width;
        ((mmi_imc_rect_p)msg_ptr->param_0)->height = editor_ptr->height;
        break;
        
    case MMI_IMC_MESSAGE_PEN_EVENT:
        ret = gui_EMS_input_box_translate_pen_event(
                        editor_ptr,
                        ((mmi_imc_editor_pen_event_struct_p)msg_ptr->param_0)->mmi_pen_event,
                        ((mmi_imc_editor_pen_event_struct_p)msg_ptr->param_0)->pos.x,
                        ((mmi_imc_editor_pen_event_struct_p)msg_ptr->param_0)->pos.y,
                        &EMS_input_box_event);
        if (ret)
        {
            EMSPosition backup_cursor = editor_ptr->data->CurrentPosition;
            ((mmi_imc_editor_pen_event_struct_p)msg_ptr->param_0)->editor_pen_event = EMS_input_box_event;

            if (GUI_EMS_INPUT_BOX_PEN_SCROLL_BAR != EMS_input_box_event 
                && ((mmi_imc_editor_pen_event_struct_p)msg_ptr->param_0)->mmi_pen_event == MMI_PEN_EVENT_DOWN)
            {
                if (!(editor_ptr->flags & UI_EMS_INPUT_BOX_VIEW_MODE))
                {
                    EMSTextFormat text_format;

                    text_format = editor_ptr->text_format;
                    gui_show_EMS_input_box_ext(editor_ptr, 
                                               ((mmi_imc_editor_pen_event_struct_p)msg_ptr->param_0)->pos.x, 
                                               ((mmi_imc_editor_pen_event_struct_p)msg_ptr->param_0)->pos.y);

                    pen_down_current_position = editor_ptr->data->CurrentPosition;

                    MoveCursorToPosition(editor_ptr->data, &backup_cursor);

                    editor_ptr->text_format = text_format;
                    position_reserved = MMI_TRUE;
                }
            #ifdef __UI_EMS_HIGHLIGHT_LIST_SUPPORT__    
                else
                {
                    if (mmi_imc_is_clipboard_state())
                    {
                        pen_down_clipboard_state = MMI_TRUE;
                    }
                    else
                    {
                        pen_down_clipboard_state = MMI_FALSE;
                    }
                }
            #endif /* __UI_EMS_HIGHLIGHT_LIST_SUPPORT__ */
                *((U32 *)msg_ptr->param_1) = 1;
            }
            else if (GUI_EMS_INPUT_BOX_PEN_SCROLL_BAR != EMS_input_box_event 
                     && ((mmi_imc_editor_pen_event_struct_p)msg_ptr->param_0)->mmi_pen_event == MMI_PEN_EVENT_UP)
            {
                if (!(editor_ptr->flags & UI_EMS_INPUT_BOX_VIEW_MODE))
                {
                    if (position_reserved)
                    {
                        MoveCursorToPosition(editor_ptr->data, &pen_down_current_position);
                        gui_EMS_input_box_set_text_format_cursor_position(editor_ptr);
                        position_reserved = MMI_FALSE;
                        gui_EMS_input_box_locate_cursor(editor_ptr);
					    wgui_EMS_set_text_format(editor_ptr->text_format);
					    redraw_EMS_inputbox();
                        msg_ptr->param_1 = 1;
                    } 
                }
                else
                {
                #ifdef __UI_EMS_HIGHLIGHT_LIST_SUPPORT__
                    /* Highlight object only when hilite list is null. */
                    if (MMI_EMS_inputbox.hilite_str_number != 0)
                    {
                        if (!mmi_imc_is_clipboard_state() && !pen_down_clipboard_state)
                        {
                            gui_show_EMS_input_box_ext(&MMI_EMS_inputbox,
                                ((mmi_imc_editor_pen_event_struct_p)msg_ptr->param_0)->pos.x,
                                ((mmi_imc_editor_pen_event_struct_p)msg_ptr->param_0)->pos.y);
                            gui_EMS_input_box_locate_cursor(&MMI_EMS_inputbox);
                            if (gui_EMS_input_box_is_pen_down_in_hilite(&MMI_EMS_inputbox))
					        {
                                gui_EMS_input_box_go_to_hilite(&MMI_EMS_inputbox,MMI_EMS_inputbox.current_hilite_idx);
                                redraw_EMS_inputbox();
                                MMI_EMS_inputbox.hilite_click_cb(MMI_EMS_inputbox.current_hilite_idx);
                            }
                        }
                    }
                    else
                #endif /* __UI_EMS_HIGHLIGHT_LIST_SUPPORT__ */
                    {
                    #ifdef __MMI_MESSAGES_EMS__
                        EMS_cancel_object_focus(); 
                    #endif
                        gui_show_EMS_input_box_ext(&MMI_EMS_inputbox,
                            ((mmi_imc_editor_pen_event_struct_p)msg_ptr->param_0)->pos.x,
                            ((mmi_imc_editor_pen_event_struct_p)msg_ptr->param_0)->pos.y);
                        gui_EMS_input_box_locate_cursor(&MMI_EMS_inputbox);
                        redraw_EMS_inputbox();
                    }
                }
            }
            else if (((mmi_imc_editor_pen_event_struct_p)msg_ptr->param_0)->mmi_pen_event == MMI_PEN_EVENT_MOVE)
            {
            	position_reserved = MMI_FALSE;
            }
#ifdef __MMI_CLIPBOARD__
            else if (GUI_EMS_INPUT_BOX_PEN_SCROLL_BAR != EMS_input_box_event 
					 && ((mmi_imc_editor_pen_event_struct_p)msg_ptr->param_0)->mmi_pen_event == MMI_PEN_EVENT_LONG_TAP)
            {
                *((U32 *)msg_ptr->param_1) = 1;
            }
#endif /* __MMI_CLIPBOARD__ */
        }
        else
        {
            position_reserved = MMI_FALSE;
        }
        
        lresult = ret;
        
        break;
        
    case MMI_IMC_MESSAGE_GET_HANDWRITING_STYLE:
        
    #if defined(__MMI_HANDWRITING_MULTI_BLOCK__)
        lresult = MMI_IMC_PEN_HANDWRITING_STYLE_MULTI_BLOCK;
    #else
        lresult = MMI_IMC_PEN_HANDWRITING_STYLE_FULL_SCREEN;
    #endif

        break;
#endif
    case MMI_IMC_MESSAGE_INSERT_NEW_LINE:
        EMS_inputbox_insert_new_line();
        if (enable_editor_show)
        {
            redraw_EMS_inputbox();
        }
        break;
    case MMI_IMC_MESSAGE_GET_TEXT:
        temp_str = (UI_string_type)msg_ptr->param_1;
        for (i = 0; i <msg_ptr->param_0; i ++)
        {
            if (!gui_EMS_input_box_get_previous_character((UI_EMS_input_box *)editor_ptr, &temp_str[i]))
            {
                break;
            }
        }
        lresult = i;
        break;
    case MMI_IMC_MESSAGE_IS_EDITOR_EMPTY:
        lresult = gui_EMS_inputbox_empty((UI_EMS_input_box *)editor_ptr);
        break;
    case MMI_IMC_MESSAGE_GET_PREVIOUS_CHAR:
        lresult = gui_EMS_input_box_get_previous_character(editor_ptr, (UI_character_type *)msg_ptr->param_0);
        break;
        
    case MMI_IMC_MESSAGE_SET_MASK:
    case MMI_IMC_MESSAGE_DECIAML_CHECK:
    case MMI_IMC_MESSAGE_DECIMAL_INPUT:
    case MMI_IMC_MESSAGE_INSERT_DECIMAL_SYMBOL:    
        ASSERT(0);
        break;
    case MMI_IMC_MESSAGE_CHECK_MULTITAP_STATE:
        if (editor_ptr->flags & UI_EMS_INPUT_BOX_STATE_MULTITAP)
            lresult = MMI_TRUE;
        break;
    case MMI_IMC_MESSAGE_INSERT_SPACE:
        EMS_inputbox_direct_input((UI_character_type)(0x20));
        break;        
    case MMI_IMC_MESSAGE_SET_KEY:
        if (!(editor_ptr->flags & UI_EMS_INPUT_BOX_VIEW_MODE))
        {
            register_EMS_inputbox_keys();
            wgui_set_EMS_inputbox_RSK();
        }
        else
        {
            register_EMS_inputbox_viewer_keys();
        }

        break;
    case MMI_IMC_MESSAGE_CHECK_CSK_ENABLE:
        if (!(editor_ptr->flags & UI_EMS_INPUT_BOX_VIEW_MODE))
        {
            lresult = MMI_TRUE;
        }
        else
        {
            lresult = MMI_FALSE; 
        }
        break;
    case MMI_IMC_MESSAGE_CHECK_INFO_BAR_ENABL:
        lresult = MMI_TRUE;
        break;
    case MMI_IMC_MESSAGE_GET_TEXT_PTR_BEFORE_CANDIDATE:
        
        if (editor_ptr->flags & UI_EMS_INPUT_BOX_STATE_MULTITAP)
        {
            *((U8 **)(msg_ptr->param_1)) = (U8 *)(editor_ptr->data->textBuffer 
                                                      + editor_ptr->data->CurrentPosition.OffsetToText - 2);
        }
        else if (editor_ptr->flags & UI_EMS_INPUT_BOX_WORD_HIGHLIGHT)
        {
            *((U8 **)(msg_ptr->param_1)) = (U8 *)(editor_ptr->data->textBuffer 
                                                      + editor_ptr->highlight_start_position.OffsetToText);
        }
        else
        {
            *((U8 **)(msg_ptr->param_1)) = (U8 *)(editor_ptr->data->textBuffer 
                                                      + editor_ptr->data->CurrentPosition.OffsetToText);
        }

        *((U8 **)(msg_ptr->param_0)) = (U8 *)editor_ptr->data->textBuffer;
        break;
        
    case MMI_IMC_MESSAGE_GET_STRING_BEFORE_CANDIDATE:
        /* if editor is in multitap state. */
        ///TODO: extend the function to get prevoious n character.
        if (editor_ptr->flags & UI_EMS_INPUT_BOX_STATE_MULTITAP)
        {
            UI_string_type buf = (UI_string_type)msg_ptr->param_1;
			EMSPosition backup_cursor = editor_ptr->data->CurrentPosition;

            i = 0;
            
			MoveCursorToPosition(editor_ptr->data, &editor_ptr->input_start_position);
            if (msg_ptr->param_0 && 
                      gui_EMS_input_box_get_previous_character(editor_ptr, (UI_character_type*)&buf[i]))
            {
                msg_ptr->param_0 --;
                i ++;
            }
            MoveCursorToPosition(editor_ptr->data, &backup_cursor);
            return i;
        }
        else if (editor_ptr->flags & UI_EMS_INPUT_BOX_WORD_HIGHLIGHT)
        {
            UI_string_type buf = (UI_string_type)msg_ptr->param_1;
            U16 backup_cursor_p = (U16)editor_ptr->data->CurrentPosition.OffsetToText;
            /* move cursor to the begining of the highlight */
            editor_ptr->data->CurrentPosition.OffsetToText = editor_ptr->highlight_start_position.OffsetToText;
            i = 0;
            if (msg_ptr->param_0 && 
                      gui_EMS_input_box_get_previous_character(editor_ptr, (UI_character_type *)&buf[i]))
            {
                msg_ptr->param_0 --;
                i ++;
            }
            /* restore cursor to the begining of the highlight */
            editor_ptr->data->CurrentPosition.OffsetToText = (kal_uint16)backup_cursor_p;
            return i;
        }
        else
        {
            UI_string_type buf = (UI_string_type)msg_ptr->param_1;
            i = 0;
            if (msg_ptr->param_0 && 
                      gui_EMS_input_box_get_previous_character(editor_ptr, (UI_character_type *)&buf[i]))
            {
                msg_ptr->param_0 --;
                i ++;
            }
            return i;
        }
        break;
    case MMI_IMC_MESSAGE_SET_MULTITAP_STATE:
        editor_ptr->flags |= UI_EMS_INPUT_BOX_STATE_MULTITAP;
        break;
    case MMI_IMC_MESSAGE_WCSS_CHECK:
        lresult = MMI_FALSE;
        break;

#ifdef __MMI_CLIPBOARD__ 

#if defined(__MMI_TOUCH_SCREEN__)
    case MMI_IMC_MESSAGE_CLIPBOARD_LOCATE_CURSOR_P_BY_POS:
        ret = gui_EMS_input_box_translate_pen_event(
                            editor_ptr,
                            ((mmi_imc_editor_pen_event_struct_p)msg_ptr->param_0)->mmi_pen_event,
                            ((mmi_imc_editor_pen_event_struct_p)msg_ptr->param_0)->pos.x,
                            ((mmi_imc_editor_pen_event_struct_p)msg_ptr->param_0)->pos.y,
                            &EMS_input_box_event);
        if (ret)
        {
            ((mmi_imc_editor_pen_event_struct_p)msg_ptr->param_0)->editor_pen_event = EMS_input_box_event;
			if (GUI_EMS_INPUT_BOX_PEN_SCROLL_BAR != EMS_input_box_event)
			{
				gui_show_EMS_input_box_ext(editor_ptr, 
                                           ((mmi_imc_editor_pen_event_struct_p)msg_ptr->param_0)->pos.x, 
                                           ((mmi_imc_editor_pen_event_struct_p)msg_ptr->param_0)->pos.y);
                if (((mmi_imc_editor_pen_event_struct_p)msg_ptr->param_0)->mmi_pen_event == MMI_PEN_EVENT_LONG_TAP)
                {
                    ((mmi_imc_clipboard_data_struct_p)msg_ptr->param_1)->ems_start_p = editor_ptr->data->CurrentPosition;
                }
                else if ((((mmi_imc_editor_pen_event_struct_p)msg_ptr->param_0)->mmi_pen_event == MMI_PEN_EVENT_MOVE) ||
                    (((mmi_imc_editor_pen_event_struct_p)msg_ptr->param_0)->mmi_pen_event == MMI_PEN_EVENT_UP))
                {
                    ((mmi_imc_clipboard_data_struct_p)msg_ptr->param_1)->ems_end_p = editor_ptr->data->CurrentPosition;
                    /* Caculate the highlight text length */
                    ((mmi_imc_clipboard_data_struct_p)msg_ptr->param_1)->highlight_text_length =
                        (((mmi_imc_clipboard_data_struct_p)msg_ptr->param_1)->ems_end_p.OffsetToText -
                        ((mmi_imc_clipboard_data_struct_p)msg_ptr->param_1)->ems_start_p.OffsetToText) / ENCODING_LENGTH;
                }
			}

            if ((((mmi_imc_editor_pen_event_struct_p)msg_ptr->param_0)->mmi_pen_event != MMI_PEN_EVENT_LONG_TAP) &&
                (((mmi_imc_editor_pen_event_struct_p)msg_ptr->param_0)->mmi_pen_event != MMI_PEN_EVENT_UP))
            {
                /* Adjust editor view when out of boundary */
                if (((mmi_imc_editor_pen_event_struct_p)msg_ptr->param_0)->pos.y < (editor_ptr->y + WGUI_INPUTS_ADJUST_VIEW_OFFSET))
                {
                    editor_ptr->display_y += WGUI_INPUTS_ADJUST_VIEW_OFFSET;
                }
                else if (((mmi_imc_editor_pen_event_struct_p)msg_ptr->param_0)->pos.y > (editor_ptr->y + editor_ptr->height - WGUI_INPUTS_ADJUST_VIEW_OFFSET))
                {
                    editor_ptr->display_y -= WGUI_INPUTS_ADJUST_VIEW_OFFSET;
                }
                if (editor_ptr->display_y > 0 || editor_ptr->height >= editor_ptr->display_height)
                {
                    editor_ptr->display_y = 0;
                }
                else if ((editor_ptr->display_y < (editor_ptr->height - editor_ptr->display_height)) && 
                         (editor_ptr->height < editor_ptr->display_height))
                {
                    editor_ptr->display_y = editor_ptr->height - editor_ptr->display_height;
                }
            }
        }
        else
        {
            if (((mmi_imc_editor_pen_event_struct_p)msg_ptr->param_0)->mmi_pen_event == MMI_PEN_EVENT_LONG_TAP)
            {
                ((mmi_imc_clipboard_data_struct_p)msg_ptr->param_1)->ems_start_p = editor_ptr->data->CurrentPosition;
            }
        }
        break;

    case MMI_IMC_MESSAGE_CLIPBOARD_ADJUST_VIEW:
        cursor_move_old_flags = editor_ptr->flags;
        editor_ptr->flags &= ~UI_EMS_INPUT_BOX_VIEW_MODE;
        if (((mmi_imc_editor_pen_event_struct_p)msg_ptr->param_0)->pos.y < editor_ptr->y)
        {
            gui_EMS_input_box_previous_line(editor_ptr);
            ((mmi_imc_clipboard_data_struct_p)msg_ptr->param_1)->ems_end_p = editor_ptr->data->CurrentPosition;
            ((mmi_imc_clipboard_data_struct_p)msg_ptr->param_1)->highlight_text_length =
                (((mmi_imc_clipboard_data_struct_p)msg_ptr->param_1)->ems_end_p.OffsetToText -
                ((mmi_imc_clipboard_data_struct_p)msg_ptr->param_1)->ems_start_p.OffsetToText) / ENCODING_LENGTH;
        }
        else if (((mmi_imc_editor_pen_event_struct_p)msg_ptr->param_0)->pos.y > (editor_ptr->y + editor_ptr->height))
        {
            gui_EMS_input_box_next_line(editor_ptr);
            ((mmi_imc_clipboard_data_struct_p)msg_ptr->param_1)->ems_end_p = editor_ptr->data->CurrentPosition;
            ((mmi_imc_clipboard_data_struct_p)msg_ptr->param_1)->highlight_text_length =
                (((mmi_imc_clipboard_data_struct_p)msg_ptr->param_1)->ems_end_p.OffsetToText -
                ((mmi_imc_clipboard_data_struct_p)msg_ptr->param_1)->ems_start_p.OffsetToText) / ENCODING_LENGTH;
        }
        editor_ptr->flags = cursor_move_old_flags;
        break;
#endif /* __MMI_TOUCH_SCREEN__ */

    case MMI_IMC_MESSAGE_CLIPBOARD_INSERT_STRING_WITH_LENGTH:
#if(UI_DOUBLE_BUFFER_SUPPORT)
        gui_lock_double_buffer();
#endif
        lresult = wgui_inputs_ems_insert_string((UI_string_type)msg_ptr->param_0, (U32)msg_ptr->param_1, MMI_TRUE);
        gui_EMS_input_box_locate_cursor(editor_ptr);
#if(UI_DOUBLE_BUFFER_SUPPORT)
        gui_unlock_double_buffer();
#endif
        redraw_EMS_inputbox();
        break;

    case MMI_IMC_MESSAGE_CLIPBOARD_SET_START_CURSOR_P:
        ((mmi_imc_clipboard_data_struct_p)msg_ptr->param_0)->ems_start_p = editor_ptr->data->CurrentPosition;
        break;

    case MMI_IMC_MESSAGE_CLIPBOARD_MARK_TEXT:
        if (((mmi_imc_clipboard_data_struct_p)msg_ptr->param_0)->highlight_text_length > 0)
        {
        editor_ptr->highlight_start_position = ((mmi_imc_clipboard_data_struct_p)msg_ptr->param_0)->ems_start_p;
        editor_ptr->highlight_end_position = ((mmi_imc_clipboard_data_struct_p)msg_ptr->param_0)->ems_end_p;
        }
        else if (((mmi_imc_clipboard_data_struct_p)msg_ptr->param_0)->highlight_text_length < 0)
        {
         editor_ptr->highlight_start_position = ((mmi_imc_clipboard_data_struct_p)msg_ptr->param_0)->ems_end_p;
         editor_ptr->highlight_end_position = ((mmi_imc_clipboard_data_struct_p)msg_ptr->param_0)->ems_start_p;
        }
        else if ((((mmi_imc_clipboard_data_struct_p)msg_ptr->param_0)->ems_start_p.OffsetToText) == 
              (((mmi_imc_clipboard_data_struct_p)msg_ptr->param_0)->ems_end_p.OffsetToText))
        {
         editor_ptr->highlight_start_position = ((mmi_imc_clipboard_data_struct_p)msg_ptr->param_0)->ems_start_p;
         editor_ptr->highlight_end_position = ((mmi_imc_clipboard_data_struct_p)msg_ptr->param_0)->ems_start_p;
        }

        cursor_move_old_flags = editor_ptr->flags;
        editor_ptr->flags &= ~UI_EMS_INPUT_BOX_VIEW_MODE;
        show_EMS_inputbox();
        editor_ptr->flags = cursor_move_old_flags;
        break;

    case MMI_IMC_MESSAGE_CLIPBOARD_MOVE_CORSOR:
        cursor_move_old_flags = editor_ptr->flags;
        editor_ptr->flags &= ~UI_EMS_INPUT_BOX_VIEW_MODE;
        switch (msg_ptr->param_0)
        {
            case MMI_IMC_EDITOR_CURSOR_UP:
                gui_EMS_input_box_previous_line(editor_ptr);
                break;
            case MMI_IMC_EDITOR_CURSOR_DOWN:
                gui_EMS_input_box_next_line(editor_ptr);
                break;
            case MMI_IMC_EDITOR_CURSOR_LEFT:
                gui_EMS_input_box_previous(editor_ptr);
                break;
            case MMI_IMC_EDITOR_CURSOR_RIGHT:
                gui_EMS_input_box_next(editor_ptr);
                break;
        }
        if (msg_ptr->param_1)
        {
            ((mmi_imc_clipboard_data_struct_p)msg_ptr->param_1)->ems_end_p = editor_ptr->data->CurrentPosition;
            /* Caculate the highlight text length */
            ((mmi_imc_clipboard_data_struct_p)msg_ptr->param_1)->highlight_text_length =
                (((mmi_imc_clipboard_data_struct_p)msg_ptr->param_1)->ems_end_p.OffsetToText -
                ((mmi_imc_clipboard_data_struct_p)msg_ptr->param_1)->ems_start_p.OffsetToText) / ENCODING_LENGTH;
        }
        else
        {
            /* Redraw editor in locate start cursor mode */
            show_EMS_inputbox();
        }
        editor_ptr->flags = cursor_move_old_flags;
        break;

    case MMI_IMC_MESSAGE_CLIPBOARD_SAVE_STATUS:

        ((mmi_imc_clipboard_data_struct_p)msg_ptr->param_0)->pre_flags = editor_ptr->flags;

        if (!mmi_imc_is_ime_state())
        {
            ((mmi_imc_clipboard_data_struct_p)msg_ptr->param_0)->ems_pre_highlight_start_p = editor_ptr->highlight_start_position;
            ((mmi_imc_clipboard_data_struct_p)msg_ptr->param_0)->ems_pre_highlight_end_p = editor_ptr->highlight_end_position;
        }
        else
        {
            ((mmi_imc_clipboard_data_struct_p)msg_ptr->param_0)->pre_flags &= ~UI_EMS_INPUT_BOX_WORD_HIGHLIGHT;
        }    

        ((mmi_imc_clipboard_data_struct_p)msg_ptr->param_0)->is_saved = 1;

        /* If view mode editor and locate start cursor position mode, we set the cursor at text start position */
        if (editor_ptr->flags & UI_EMS_INPUT_BOX_VIEW_MODE && (msg_ptr->param_1))
        {
            gui_EMS_input_box_set_cursor_position(editor_ptr, &(editor_ptr->start_position));
            editor_ptr->display_y = 0;
        }

        editor_ptr->flags |= UI_EMS_INPUT_BOX_WORD_HIGHLIGHT;
        editor_ptr->flags &= ~UI_EMS_INPUT_BOX_DISABLE_CURSOR_DRAW;
        memset(&editor_ptr->highlight_start_position, 0, sizeof(EMSPosition));
        memset(&editor_ptr->highlight_end_position, 0, sizeof(EMSPosition));
        break;

    case MMI_IMC_MESSAGE_CLIPBOARD_RESTORE_STATUS:
        editor_ptr->highlight_start_position = ((mmi_imc_clipboard_data_struct_p)msg_ptr->param_0)->ems_pre_highlight_start_p;
        editor_ptr->highlight_end_position = ((mmi_imc_clipboard_data_struct_p)msg_ptr->param_0)->ems_pre_highlight_end_p;
        editor_ptr->flags = ((mmi_imc_clipboard_data_struct_p)msg_ptr->param_0)->pre_flags;
        /* If read only editor, stop cursor draw */
        if (editor_ptr->flags & UI_EMS_INPUT_BOX_DISABLE_CURSOR_DRAW)
        {
            StopTimer(BLINKING_CURSOR);
        }
        break;

    case MMI_IMC_MESSAGE_CLIPBOARD_GET_ALL_TEXT:
         *((S8 **)(msg_ptr->param_0)) = (S8 *)editor_ptr->data->textBuffer;
         *((U32 *)msg_ptr->param_1) = editor_ptr->data->textLength;
        break;

    case MMI_IMC_MESSAGE_CLIPBOARD_GET_HIGHLIGHT_TEXT:
        if (((mmi_imc_clipboard_data_struct_p)msg_ptr->param_0)->highlight_text_length > 0)
        {
            *((U8 **)(msg_ptr->param_1)) = (U8 *)((S8 *)editor_ptr->data->textBuffer + 
                ((mmi_imc_clipboard_data_struct_p)msg_ptr->param_0)->ems_start_p.OffsetToText);
        }
        else
        {
            *((U8 **)(msg_ptr->param_1)) = (U8 *)((S8 *)editor_ptr->data->textBuffer + 
                ((mmi_imc_clipboard_data_struct_p)msg_ptr->param_0)->ems_end_p.OffsetToText);
        }
        break;    
    case MMI_IMC_MESSAGE_CLIPBOARD_IS_TEXT_HIGHLIGHT:
        if (((mmi_imc_clipboard_data_struct_p)msg_ptr->param_0)->highlight_text_length != 0)
        {
            lresult = 1;
        }
        else
        {
            lresult = 0;
        }
        break;

    case MMI_IMC_MESSAGE_CLIPBOARD_IS_READ_ONLY_EDITOR:
        if (msg_ptr->param_0 == 0)
        {
            lresult = (editor_ptr->flags & UI_EMS_INPUT_BOX_VIEW_MODE);
        }
        else 
        {
            lresult = (((mmi_imc_clipboard_data_struct_p)msg_ptr->param_0)->pre_flags & UI_EMS_INPUT_BOX_VIEW_MODE);
        }

        break;

    case MMI_IMC_MESSAGE_CLIPBOARD_SET_HIGHLIGHT:
        /* Restore highlight info */
        if (((mmi_imc_clipboard_data_struct_p)msg_ptr->param_0)->highlight_text_length > 0)
        {
            editor_ptr->highlight_start_position = ((mmi_imc_clipboard_data_struct_p)msg_ptr->param_0)->ems_start_p;
            editor_ptr->highlight_end_position = ((mmi_imc_clipboard_data_struct_p)msg_ptr->param_0)->ems_end_p;
        }
        else if (((mmi_imc_clipboard_data_struct_p)msg_ptr->param_0)->highlight_text_length < 0)
        {
            editor_ptr->highlight_start_position = ((mmi_imc_clipboard_data_struct_p)msg_ptr->param_0)->ems_end_p;
            editor_ptr->highlight_end_position = ((mmi_imc_clipboard_data_struct_p)msg_ptr->param_0)->ems_start_p;
        }
        else
        {
            memset(&editor_ptr->highlight_end_position, 0, sizeof(EMSPosition));
        }

        /* Restore cursor position */
        if (((mmi_imc_clipboard_data_struct_p)msg_ptr->param_0)->ems_end_p.OffsetToText > 0)
        {
            gui_EMS_input_box_set_cursor_position(editor_ptr, &(((mmi_imc_clipboard_data_struct_p)msg_ptr->param_0)->ems_end_p));
        }
        editor_ptr->flags |= UI_EMS_INPUT_BOX_WORD_HIGHLIGHT;
        editor_ptr->flags &= ~UI_EMS_INPUT_BOX_DISABLE_CURSOR_DRAW;
        ((mmi_imc_clipboard_data_struct_p)msg_ptr->param_0)->is_saved = 1;
        break;

    case MMI_IMC_MESSAGE_CLIPBOARD_GET_EDITOR_TYPE:
        if (editor_ptr->flags & UI_EMS_INPUT_BOX_VIEW_MODE)
        {
            ((mmi_imc_editor_menu_history_data_struct_p)msg_ptr->param_0)->is_read_only = MMI_TRUE;
        }
        else
        {
            ((mmi_imc_editor_menu_history_data_struct_p)msg_ptr->param_0)->is_read_only = MMI_FALSE;
        }

        if ((UI_EMS_input_box *)editor_ptr->data->textLength == 0)
        {
            ((mmi_imc_editor_menu_history_data_struct_p)msg_ptr->param_0)->is_empty = MMI_TRUE;
        }
        else
        {
            ((mmi_imc_editor_menu_history_data_struct_p)msg_ptr->param_0)->is_empty = MMI_FALSE;
        }
        ((mmi_imc_editor_menu_history_data_struct_p)msg_ptr->param_0)->is_paging = MMI_FALSE;
        ((mmi_imc_editor_menu_history_data_struct_p)msg_ptr->param_0)->is_wcss = MMI_FALSE;
        ((mmi_imc_editor_menu_history_data_struct_p)msg_ptr->param_0)->is_password = MMI_FALSE;
        break;

    case MMI_IMC_MESSAGE_CLIPBOARD_CUT_HIGHLIGHT_STRING:
        old_show_action_flag = MMI_EMS_inputbox.show_action_flag;
        MMI_EMS_inputbox.show_action_flag = 0;
        if (msg_ptr->param_1 == 1)
        {
            /* Mark text backward, start > end */
            gui_EMS_input_box_set_cursor_position(editor_ptr, &(((mmi_imc_clipboard_data_struct_p)msg_ptr->param_0)->ems_start_p));
            highlight_count = gui_EMS_input_box_get_unit_count(
                editor_ptr, 
                ((mmi_imc_clipboard_data_struct_p)msg_ptr->param_0)->ems_end_p,
                ((mmi_imc_clipboard_data_struct_p)msg_ptr->param_0)->ems_start_p);
        }
        else if (msg_ptr->param_1 == 0)
        {
            /* Mark text forward, start < end */
            highlight_count = gui_EMS_input_box_get_unit_count(
                editor_ptr, 
                ((mmi_imc_clipboard_data_struct_p)msg_ptr->param_0)->ems_start_p,
                ((mmi_imc_clipboard_data_struct_p)msg_ptr->param_0)->ems_end_p);
        }
        else if (msg_ptr->param_1 == 3)
        {
            /* Mark text backward, memory not enough, start > end */
            cut_cursor_p = ((mmi_imc_clipboard_data_struct_p)msg_ptr->param_0)->ems_end_p;
            while (editor_ptr->data->CurrentPosition.OffsetToText < (cut_cursor_p.OffsetToText + WGUI_INPUTS_CLIPBOARD_MAX_SIZE))
            {
                gui_EMS_input_box_next(editor_ptr);
                highlight_count++;
            }
        }
        else if (msg_ptr->param_1 == 2)
        {
            /* Mark text forward, memory not enough, start < end */
            cut_cursor_p = ((mmi_imc_clipboard_data_struct_p)msg_ptr->param_0)->ems_start_p;
            gui_EMS_input_box_set_cursor_position(editor_ptr, &(cut_cursor_p));
            while (editor_ptr->data->CurrentPosition.OffsetToText < (cut_cursor_p.OffsetToText + WGUI_INPUTS_CLIPBOARD_MAX_SIZE))
            {
                gui_EMS_input_box_next(editor_ptr);
                highlight_count++;
            }
        }

        while (highlight_count)
        {
            if (lresult == 0)
            {
                temp_position = editor_ptr->data->CurrentPosition;
                pre_obj = gui_EMS_input_box_get_previous_object(editor_ptr->data, &temp_position, &c, &obj);
                if (pre_obj != 1)
                {
                    /* Unsupported object (Pic, melody, format...) */
                    lresult = 1;
                }
            }
            EMS_inputbox_backspace_no_draw();
            highlight_count--;
        }
        MMI_EMS_inputbox.show_action_flag = old_show_action_flag;
        gui_EMS_input_box_locate_cursor(&MMI_EMS_inputbox);

        EMS_inputbox_input_callback();
        break;

    case MMI_IMC_MESSAGE_CLIPBOARD_CUT_ALL:
        if (msg_ptr->param_0 == 0)
        {
            if (MMI_EMS_inputbox.data->listHead != NULL)
            {
                /* Unsupported object (Pic, melody, format...) */
                lresult = 1;
            }
            EMS_inputbox_delete_all();
        }
        else if (msg_ptr->param_0 == 1)
        {
            gui_EMS_input_box_set_cursor_position(editor_ptr, &(editor_ptr->start_position));
            old_show_action_flag = MMI_EMS_inputbox.show_action_flag;
            MMI_EMS_inputbox.show_action_flag = 0;
            while (editor_ptr->data->CurrentPosition.OffsetToText < (editor_ptr->start_position.OffsetToText + WGUI_INPUTS_CLIPBOARD_MAX_SIZE))
            {
                gui_EMS_input_box_next(editor_ptr);
            }
            while (!((editor_ptr->data->CurrentPosition.OffsetToText == editor_ptr->start_position.OffsetToText) && 
                     (editor_ptr->data->CurrentPosition.Object == editor_ptr->start_position.Object)))
            {
                if (lresult == 0)
                {
                    temp_position = editor_ptr->data->CurrentPosition;
                    pre_obj = gui_EMS_input_box_get_previous_object(editor_ptr->data, &temp_position, &c, &obj);
                    if (pre_obj != 1)
                    {
                        /* Unsupported object (Pic, melody, format...) */
                        lresult = 1;
                    }
                }
                EMS_inputbox_backspace_no_draw();
            }
            MMI_EMS_inputbox.show_action_flag = old_show_action_flag;

            gui_EMS_input_box_locate_cursor(&MMI_EMS_inputbox);
        }
        break;
        
    case MMI_IMC_MESSAGE_CLIPBOARD_IS_PASSWORD_EDITOR:
        lresult = MMI_FALSE;
        break;

    case MMI_IMC_MESSAGE_CLIPBOARD_IS_DISABLE:
        lresult = MMI_FALSE;
        break;

#endif /* __MMI_CLIPBOARD__ */

    default:
        break;
    }
    
    UI_UNUSED_PARAMETER(ret);

    return lresult;
}


/*****************************************************************************
 * FUNCTION
 *  CloseCategory28Screen
 * DESCRIPTION
 *  Releases data used by the MO EMS/SMS screen
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void CloseCategory28Screen(void)
{
#if(UI_DISABLE_EMS_INPUT_BOX)
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    S32 length;
    S32 i, j;
    U8 *buffer;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    length = wgui_inputs_ml_get_text_length();
    buffer = (U8*) gui_malloc((length << 1) + 2);
    i = j = 0;
    ResetCurrentPosition(temp_EMS_data);
    while (i < length)
    {
        buffer[j++] = 0;
        buffer[j++] = (U8) temp_EMS_buffer[i++];
    }
    buffer[j++] = 0;
    buffer[j++] = '\0';
    AddString(temp_EMS_data, buffer, (U16) length, NULL);
    gui_free(buffer);
    gui_free(temp_EMS_buffer);
#endif /* (UI_DISABLE_EMS_INPUT_BOX) */ 
}


/*****************************************************************************
 * FUNCTION
 *  ExitCategory28Screen
 * DESCRIPTION
 *  Exits the MO EMS/SMS screen
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void ExitCategory28Screen(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    EMS_inputbox_has_changed = 0;
    category28_RSK_label_clear = 0;
    category28_RSK_function = NULL;
    wgui_inputbox_information_flag = 0;
    mmi_imc_disconnect();
#ifdef __MMI_MESSAGES_EMS__
    close_EMS_objects();
#endif 
#if(!UI_DISABLE_EMS_INPUT_BOX)
    {
        wgui_EMS_text_format = MMI_EMS_inputbox.text_format;
        reset_EMS_inputbox();
    }
#endif /* (!UI_DISABLE_EMS_INPUT_BOX) */ 

#ifdef __MMI_WALLPAPER_ON_BOTTOM__
    dm_set_scr_bg_opacity(editor_scr_bg_opacity);
#endif /* __MMI_WALLPAPER_ON_BOTTOM__ */ 

    ExitCategoryFunction = MMI_dummy_function;
    RedrawCategoryFunction = MMI_dummy_function;
    GetCategoryHistory = dummy_get_history;
    GetCategoryHistorySize = dummy_get_history_size;
    /* W05.36 Fix Vietnamese Tone Input Issue */
    wgui_inputs_set_current_input_box_type(EDITOR_NONE_INPUT_BOX);
    wgui_EMS_reset_input_information();
}


/*****************************************************************************
 * FUNCTION
 *  GetCategory28HistorySize
 * DESCRIPTION
 *  Gets the history buffer size for the MO EMS/SMS screen
 * PARAMETERS
 *  void
 * RETURNS
 *  size in U8s of the history buffer
 *****************************************************************************/
S32 GetCategory28HistorySize(void)
{
#if(UI_DISABLE_EMS_INPUT_BOX)
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    return (0);
#else /* (UI_DISABLE_EMS_INPUT_BOX) */ 
    return (sizeof(EMS_inputbox_category_history));
#endif /* (UI_DISABLE_EMS_INPUT_BOX) */ 
}


/*****************************************************************************
 * FUNCTION
 *  GetCategory28History
 * DESCRIPTION
 *  Gets the history buffer for the MO EMS/SMS screen
 * PARAMETERS
 *  history_buffer      [IN]        Is the buffer into which the history data is stored (pre-allocated)
 * RETURNS
 *  pointer to the history buffer
 *****************************************************************************/
U8 *GetCategory28History(U8 *history_buffer)
{
#if(UI_DISABLE_EMS_INPUT_BOX)
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    return (history_buffer);
#else /* (UI_DISABLE_EMS_INPUT_BOX) */ 
    get_EMS_inputbox_category_history(MMI_CATEGORY28_ID, history_buffer);
    return (history_buffer);
#endif /* (UI_DISABLE_EMS_INPUT_BOX) */ 
}


/*****************************************************************************
 * FUNCTION
 *  RedrawCategory39Screen
 * DESCRIPTION
 *  Redraws the MT EMS/SMS screen
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void RedrawCategory39Screen(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    gdi_layer_lock_frame_buffer();
    clear_screen();
    show_title_status_icon();
    draw_title();
    show_softkey_background();
    show_left_softkey();
    show_right_softkey();
#if(UI_DISABLE_EMS_INPUT_BOX)
    wgui_inputs_ml_show();
#else 
    show_EMS_inputbox();
#endif 
    gdi_layer_unlock_frame_buffer();
    gdi_layer_blt_previous(0, 0, UI_device_width - 1, UI_device_height - 1);
}


/* For detail description, please refer to wgui_categories_inputs.h */
void ShowCategory39Screen(
        U16 title,
        U16 title_icon,
        U16 left_softkey,
        U16 left_softkey_icon,
        U16 right_softkey,
        U16 right_softkey_icon,
        EMSData *data,
        U8 *header,
        U8 *history_buffer)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    dm_data_struct dm_data;

#ifdef __MMI_CLIPBOARD__
    mmi_imm_input_mode_enum default_input_mode = IMM_INPUT_MODE_NONE;
#endif /* __MMI_CLIPBOARD__ */

#if(UI_DISABLE_EMS_INPUT_BOX)
    S32 length;
    S32 i, j, h, fh;

    UI_UNUSED_PARAMETER(history_buffer);
#else /* (UI_DISABLE_EMS_INPUT_BOX) */ 
    U8 h;
#endif /* (UI_DISABLE_EMS_INPUT_BOX) */ 
#ifdef __UI_EMS_HIGHLIGHT_LIST_SUPPORT__
    S32 saved_display_y;
#endif /* __UI_EMS_HIGHLIGHT_LIST_SUPPORT__ */

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    gui_setup_common_layout();

#if(UI_DOUBLE_BUFFER_SUPPORT)
    gui_lock_double_buffer();
#endif

    EMS_inputbox_has_changed = 0;
#ifdef __MMI_MESSAGES_EMS__
    initialize_EMS_objects();
#endif 
    wgui_title_set_menu_shortcut_number(-1);
    change_left_softkey(left_softkey, left_softkey_icon);
    change_right_softkey(right_softkey, right_softkey_icon);
    SetupCategoryKeyHandlers();

    MMI_title_string = (UI_string_type) get_string(title);
    MMI_title_icon = (PU8) get_image(title_icon);

#if(UI_DISABLE_EMS_INPUT_BOX)
    length = (data->textBufferSize >> 1);
    if (length == 0)
    {
        UI_string_type s = (UI_string_type) "EMS Data not initialized";
        S32 l = gui_strlen((UI_string_type) s);

        temp_EMS_buffer = (UI_string_type) gui_malloc(l * sizeof(UI_character_type));
        gui_strcpy((UI_string_type) temp_EMS_buffer, (UI_string_type) s);
        length = l + 1;
        i = l;
    }
    else
    {
        temp_EMS_buffer = (UI_string_type) gui_malloc(length * sizeof(UI_character_type));
        i = j = 0;
        while (j < data->textLength)
        {
            if ((data->textBuffer[j] == '\0') && (data->textBuffer[j + 1] == '\0'))
            {
                temp_EMS_buffer[i] = '\0';
                break;
            }
            else
            {
                temp_EMS_buffer[i] = data->textBuffer[j + 1];
            }
            i++;
            j += 2;
        }
    }
    temp_EMS_data = data;
    wgui_inputs_ml_create_set_buffer(temp_EMS_buffer, length, i, 0);
    wgui_inputs_ml_register_keys();
    wgui_inputs_ml_move(0, (MMI_title_y + MMI_title_height));
    h = MMI_content_height - MMI_multitap_height - 8;
    gui_set_font(MMI_multiline_inputbox.text_font);
    fh = gui_get_character_height();
    h = ((h / fh) * fh) + 8;
    wgui_inputs_ml_resize(WGUI_INPUTS_STYLE_DEFAULT, h);
    wgui_inputs_ml_set_mask(0);
#else /* (UI_DISABLE_EMS_INPUT_BOX) */ 
#if((UI_ENABLE_FRAME_SKIPPING) && (ENABLE_EMS_INPUTBOX_FRAME_SKIPPING))
    wgui_EMS_inputbox_frame_counter = 0;
#endif 
    register_EMS_inputbox_input_callback(UI_dummy_function);
    gui_create_EMS_input_box(
        &MMI_EMS_inputbox,
        0,
        (MMI_title_y + MMI_title_height),
        MMI_content_width,
        MMI_content_height);
    
    MMI_EMS_inputbox.flags |= UI_EMS_INPUT_BOX_VIEW_MODE;
    gui_set_EMS_input_box_data(&MMI_EMS_inputbox, data);

#ifdef __UI_EMS_HIGHLIGHT_LIST_SUPPORT__
    wgui_inputs_EMS_set_hilite_info();
#endif /* __UI_EMS_HIGHLIGHT_LIST_SUPPORT__ */

    h = set_EMS_inputbox_category_history(MMI_CATEGORY39_ID, history_buffer);
#ifdef __UI_EMS_HIGHLIGHT_LIST_SUPPORT__
    if (MMI_EMS_inputbox.hilite_str_number != 0)
    {
        /* Go to highlight will change the visible range, so we need to save it before, then restore after goto hilite */
        saved_display_y = MMI_EMS_inputbox.display_y;
    	gui_EMS_input_box_go_to_hilite(&MMI_EMS_inputbox, MMI_EMS_inputbox.current_hilite_idx);
        MMI_EMS_inputbox.display_y = saved_display_y;
    }
#endif /* __UI_EMS_HIGHLIGHT_LIST_SUPPORT__ */
    if (!h)
    {
        ResetCurrentPosition(MMI_EMS_inputbox.data);
    }
    MMI_EMS_inputbox.flags |= UI_EMS_INPUT_BOX_DISABLE_CURSOR_DRAW;

#ifdef __MMI_CLIPBOARD__
    mmi_imm_set_required_mode_list(IMM_INPUT_TYPE_SENTENCE, NULL, default_input_mode);
    g_mmi_editor_hanler.input_box_type = MMI_EDITOR_EMS_INPUT_BOX;
    g_mmi_editor_hanler.input_box_sub_type = MMI_EDITOR_NORMAL_INPUT_BOX;
    g_mmi_editor_hanler.input_box_handler = &MMI_EMS_inputbox;
    mmi_imc_disable_key_input();
#ifdef __MMI_TOUCH_SCREEN__
    mmi_imc_disable_handwriting();
    mmi_imc_disable_virtual_keyboard();
#endif /* __MMI_TOUCH_SCREEN__ */
    mmi_imc_connect((void *)&g_mmi_editor_hanler, mmi_input_box_msg_call_back_ems);
#endif /* __MMI_CLIPBOARD__ */

#ifdef __MMI_WALLPAPER_ON_BOTTOM__ 
    MMI_EMS_inputbox.flags |= UI_EMS_INPUT_BOX_TRANSPARENT_BACKGROUND;
    dm_get_scr_bg_opacity(&editor_scr_bg_opacity);
    dm_set_scr_bg_opacity((U8)(current_MMI_theme->bg_opacity_low));
#endif    
    register_EMS_inputbox_viewer_keys();
    create_EMS_viewer_header(header);
    MMI_EMS_inputbox.display_header = EMS_viewer_show_header;
    MMI_EMS_inputbox.measure_header = EMS_viewer_measure_header;
#endif /* (UI_DISABLE_EMS_INPUT_BOX) */
    
#if(UI_DOUBLE_BUFFER_SUPPORT)
    gui_unlock_double_buffer();
#endif

    ExitCategoryFunction = ExitCategory39Screen;
    dm_register_category_controlled_callback(DrawCate39CategoryControlArea);
    dm_setup_category_functions(dm_redraw_category_screen, GetCategory39History, GetCategory39HistorySize);
    dm_data.s32ScrId = (S32) GetActiveScreenId();
    dm_data.s32CatId = MMI_CATEGORY39_ID;
    dm_data.s32flags = DM_CLEAR_SCREEN_BACKGROUND;
    dm_setup_data(&dm_data);
    dm_redraw_category_screen();
}


/*****************************************************************************
 * FUNCTION
 *  DrawCate39CategoryControlArea
 * DESCRIPTION
 *  This function is used to draw the category controlled area of category39 screen
 * PARAMETERS
 *  coordinate      [IN/OUT]        Coordinates of category controlled area.
 * RETURNS
 *  void
 *****************************************************************************/
void DrawCate39CategoryControlArea(dm_coordinates *coordinate)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    S32 top_image_width, top_image_height;
    S32 bottom_image_width, bottom_image_height;
    S32 header_height;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    header_height = EMS_viewer_measure_header();
#if defined(__MMI_MAINLCD_128X128__)
    EMS_viewer_show_header(coordinate->s16X,
        coordinate->s16Y,
        coordinate->s16Width,
        coordinate->s16Y + header_height);

    coordinate->s16Height = header_height;
#else
    gdi_image_get_dimension_id(WGUI_IMG_TEXT_BG_TOP, &top_image_width, &top_image_height);
    gdi_image_get_dimension_id(WGUI_IMG_TEXT_BG_TOP, &bottom_image_width, &bottom_image_height);

    EMS_viewer_show_header(coordinate->s16X,
        coordinate->s16Y + top_image_height,
        coordinate->s16Width,
        coordinate->s16Y + header_height + top_image_height);

    coordinate->s16Height = header_height + top_image_height + bottom_image_height;
#endif
}


/*****************************************************************************
 * FUNCTION
 *  CloseCategory39Screen
 * DESCRIPTION
 *  Releases data used by the MT EMS/SMS screen
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void CloseCategory39Screen(void)
{
#if(UI_DISABLE_EMS_INPUT_BOX)
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    S32 length;
    S32 i, j;
    U8 *buffer;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    length = wgui_inputs_ml_get_text_length();
    buffer = (U8*) gui_malloc((length << 1) + 2);
    i = j = 0;
    ResetCurrentPosition(temp_EMS_data);
    while (i < length)
    {
        buffer[j++] = 0;
        buffer[j++] = (U8) temp_EMS_buffer[i++];
    }
    buffer[j++] = 0;
    buffer[j++] = '\0';
    AddString(temp_EMS_data, buffer, (U16) length, NULL);
    gui_free(buffer);
    gui_free(temp_EMS_buffer);
#endif /* (UI_DISABLE_EMS_INPUT_BOX) */ 
}


/*****************************************************************************
 * FUNCTION
 *  ExitCategory39Screen
 * DESCRIPTION
 *  Exits the MT EMS/SMS screen
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void ExitCategory39Screen(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
#if(!UI_DISABLE_EMS_INPUT_BOX)
    reset_EMS_inputbox();
#endif 

#ifdef __MMI_CLIPBOARD__
    mmi_imc_disconnect();
#endif /* __MMI_CLIPBOARD__ */

#ifdef __MMI_MESSAGES_EMS__
    close_EMS_objects();
#endif 
#ifdef __MMI_WALLPAPER_ON_BOTTOM__ 
    dm_set_scr_bg_opacity(editor_scr_bg_opacity);
#endif 
    ExitCategoryFunction = MMI_dummy_function;
    RedrawCategoryFunction = MMI_dummy_function;
    GetCategoryHistory = dummy_get_history;
    GetCategoryHistorySize = dummy_get_history_size;
}


/*****************************************************************************
 * FUNCTION
 *  GetCategory39HistorySize
 * DESCRIPTION
 *  Gets the history buffer size for the MT EMS/SMS screen
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
S32 GetCategory39HistorySize(void)
{
#if(UI_DISABLE_EMS_INPUT_BOX)
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    return (0);
#else /* (UI_DISABLE_EMS_INPUT_BOX) */ 
    return (sizeof(EMS_inputbox_category_history));
#endif /* (UI_DISABLE_EMS_INPUT_BOX) */ 

}


/*****************************************************************************
 * FUNCTION
 *  GetCategory39History
 * DESCRIPTION
 *  Gets the history buffer for the MT EMS/SMS screen
 * PARAMETERS
 *  history_buffer      [?]             
 *  history(?)          [IN/OUT]        The buffer into which the history data is stored (pre-allocated)
 * RETURNS
 *  void
 *****************************************************************************/
U8 *GetCategory39History(U8 *history_buffer)
{
#if(UI_DISABLE_EMS_INPUT_BOX)
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    return (history_buffer);
#else /* (UI_DISABLE_EMS_INPUT_BOX) */ 
    get_EMS_inputbox_category_history(MMI_CATEGORY39_ID, history_buffer);
    return (history_buffer);
#endif /* (UI_DISABLE_EMS_INPUT_BOX) */ 
}


/* Cat_215 Start */


/*****************************************************************************
 * FUNCTION
 *  cat_215_text_change_event_callback
 * DESCRIPTION
 *  Function to call info bar fillers
 * PARAMETERS
 *  event       [IN]        Action performed on insert, delete character or delete all
 *  C           [IN]        Character to insert or delete
 * RETURNS
 *  void
 *****************************************************************************/
MMI_BOOL cat_215_text_change_event_callback(gui_multi_line_input_box_change_event_enum event, U16 C)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    MMI_BOOL result = MMI_TRUE;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    switch (event)
    {
        case GUI_MULTI_LINE_INPUT_BOX_INSERT_CHAR:
            if (cat_215_text_length + app_unicode_to_utf8_len(C) > (wgui_inputbox_buffer_size - 1))
            {
                result = MMI_FALSE;
            }
            else
            {
                cat_215_text_length += app_unicode_to_utf8_len(C);
            }
            break;
        case GUI_MULTI_LINE_INPUT_BOX_DELETE_CHAR:
            cat_215_text_length -= app_unicode_to_utf8_len(C);
            break;
        case GUI_MULTI_LINE_INPUT_BOX_DELETEALL:
            cat_215_text_length = 0;
            break;
    }
    return result;
}


/*****************************************************************************
 * FUNCTION
 *  cat_215_text_total_characters_in_byte_callback
 * DESCRIPTION
 *  Function to call info bar fillers
 * PARAMETERS
 *  x1      [IN]        Start x position of input box
 *  y1      [IN]        Start y position of input box
 *  x2      [IN]        End x position of input box
 *  y2      [IN]        End y position of input box
 * RETURNS
 *  void
 *****************************************************************************/
void cat_215_text_total_characters_in_byte_callback(S32 x1, S32 y1, S32 x2, S32 y2)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    color c;

#if !defined(__MMI_TOUCH_SCREEN__)
    stFontAttribute *f = &MMI_small_font;
    S32 w;
#else /* !defined(__MMI_TOUCH_SCREEN__) */ 
    stFontAttribute *f = &MMI_medium_font;
    S32 w, h;
#endif /* !defined(__MMI_TOUCH_SCREEN__) */ 
    UI_character_type str[32];

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    gui_lock_double_buffer();
    gui_reset_text_clip();
    wgui_inputs_input_information_background(x1, y1, x2, y2);
    wgui_inputs_ml_show_current_input_method(x1, y1, x2, y2);
    gui_sprintf(str, "%d/%d", cat_215_text_length, (wgui_inputbox_buffer_size - 1));
    c = *current_MMI_theme->remaining_length_text_color;
    gui_set_font(f);
    gui_set_text_color(c);
    gui_set_text_clip(0, 0, UI_device_width - 1, UI_device_height - 1);
#if !defined(__MMI_TOUCH_SCREEN__)
    w = gui_get_string_width(str);
#else 
    gui_measure_string(str, &w, &h);
#endif 
    if (!r2lMMIFlag)
#if !defined(__MMI_TOUCH_SCREEN__)
        gui_move_text_cursor(x2 - 2 - w, y1 + 2);
#else 
        gui_move_text_cursor(x2 - 2 - w, y1 + (wgui_inputbox_information_bar_height - h) / 2);
#endif 
    else
#if !defined(__MMI_TOUCH_SCREEN__)
        gui_move_text_cursor(x1 + 2 + w, y1 + 2);
#else 
        gui_move_text_cursor(x1 + 2 + w, y1 + (wgui_inputbox_information_bar_height - h) / 2);
#endif 
    gui_print_text(str);
    gui_unlock_double_buffer();
    gui_BLT_double_buffer(x1, y1, x2, y2);
}


/*****************************************************************************
 * FUNCTION
 *  cat_215_draw_infobar_callback
 * DESCRIPTION
 *  Function to call info bar fillers
 * PARAMETERS
 *  x1      [IN]        Start x position of input box
 *  y1      [IN]        Start y position of input box
 *  x2      [IN]        End x position of input box
 *  y2      [IN]        End y position of input box
 * RETURNS
 *  void
 *****************************************************************************/
void cat_215_draw_infobar_callback(S32 x1, S32 y1, S32 x2, S32 y2)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    cat_215_text_total_characters_in_byte_callback(x1, y1, x2, y2);
}


/*****************************************************************************
 * FUNCTION
 *  cat_215_fit_text_for_ut8_length_in_multiline_inputbox
 * DESCRIPTION
 *  Function to take only buffer upto limit
 * PARAMETERS
 *  buffer      [IN/OUT]        To change the string buffer to the passed size
 * RETURNS
 *  void
 *****************************************************************************/
void cat_215_fit_text_for_ut8_length_in_multiline_inputbox(U8 *buffer)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U8 i = 0;
    U8 char_len;
    U16 ucs2_char;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    cat_215_text_length = 0;
    ucs2_char = (buffer[i]) | ((buffer[i + 1] << 8));
    char_len = app_unicode_to_utf8_len(ucs2_char);
    while (ucs2_char && (cat_215_text_length + char_len <= (wgui_inputbox_buffer_size - 1)))
    {
        cat_215_text_length += char_len;
        i += ENCODING_LENGTH;
        ucs2_char = (buffer[i]) | ((buffer[i + 1] << 8));
        char_len = app_unicode_to_utf8_len(ucs2_char);
    }
    buffer[i] = 0;
    buffer[i + 1] = 0;
}


/* For detail description, please refer to wgui_categories_inputs.h */
void ShowCategory215Screen(
        U16 title,
        U16 title_icon,
        U16 left_softkey,
        U16 left_softkey_icon,
        U16 right_softkey,
        U16 right_softkey_icon,
        U32 input_type,
        U8 *buffer,
        S32 buffer_size,
        U8 *history_buffer)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    gui_lock_double_buffer();
    gui_setup_common_layout();
    wgui_inputbox_buffer_size = buffer_size;
    cat_215_fit_text_for_ut8_length_in_multiline_inputbox(buffer);
    ShowCategory5Screen(
        title,
        title_icon,
        left_softkey,
        left_softkey_icon,
        right_softkey,
        right_softkey_icon,
        input_type,
        buffer,
        buffer_size,
        history_buffer);
    wgui_inputs_ml_register_change_event_handler(cat_215_text_change_event_callback);
    wgui_inputs_ml_register_infobar_callback(
        cat_215_draw_infobar_callback,
        cat_215_text_total_characters_in_byte_callback,
        0);
    wgui_inputs_ml_redraw_input_information_bar();
    gui_unlock_double_buffer();
    gui_BLT_double_buffer(0, 0, UI_device_width - 1, UI_device_height - 1);
}


/*****************************************************************************
 * FUNCTION
 *  cat_215_fit_text_for_gb_length_in_multiline_inputbox
 * DESCRIPTION
 *  Function to take only buffer upto limit
 * PARAMETERS
 *  buffer      [IN/OUT]        To change the string buffer to the passed size
 * RETURNS
 *  void
 *****************************************************************************/
void cat_215_fit_text_for_gb_length_in_multiline_inputbox(U8 *buffer)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U8 i = 0;
    U8 char_len;
    U16 ucs2_char;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    cat_215_text_length = 0;
    ucs2_char = (buffer[i]) | ((buffer[i + 1] << 8));
    char_len = wgui_inputs_ucs2_to_gb_len(ucs2_char);
    while (ucs2_char && (cat_215_text_length + char_len <= (wgui_inputbox_buffer_size - 1)))
    {
        cat_215_text_length += char_len;
        i += ENCODING_LENGTH;
        ucs2_char = (buffer[i]) | ((buffer[i + 1] << 8));
        char_len = wgui_inputs_ucs2_to_gb_len(ucs2_char);
    }
    buffer[i] = 0;
    buffer[i + 1] = 0;
}


/*****************************************************************************
 * FUNCTION
 *  cat_215_text_change_event_callback
 * DESCRIPTION
 *  Function to call info bar fillers
 * PARAMETERS
 *  event       [IN]        Action performed on insert, delete character or delete all
 *  C           [IN]        Character to insert or delete
 * RETURNS
 *  void
 *****************************************************************************/
MMI_BOOL cat_215_ext_text_change_event_callback(gui_multi_line_input_box_change_event_enum event, U16 C)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    MMI_BOOL result = MMI_TRUE;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    switch (event)
    {
        case GUI_MULTI_LINE_INPUT_BOX_INSERT_CHAR:
            if (cat_215_text_length + wgui_inputs_ucs2_to_gb_len(C) > (wgui_inputbox_buffer_size - 1))
            {
                result = MMI_FALSE;
            }
            else
            {
                cat_215_text_length += wgui_inputs_ucs2_to_gb_len(C);
            }
            break;
        case GUI_MULTI_LINE_INPUT_BOX_DELETE_CHAR:
            cat_215_text_length -= wgui_inputs_ucs2_to_gb_len(C);
            break;
        case GUI_MULTI_LINE_INPUT_BOX_DELETEALL:
            cat_215_text_length = 0;
            break;
    }
    return result;
}


/* For detail description, please refer to wgui_categories_inputs.h */
void ShowCategory215Screen_ext(
        U16 title,
        U16 title_icon,
        U16 left_softkey,
        U16 left_softkey_icon,
        U16 right_softkey,
        U16 right_softkey_icon,
        U32 input_type,
        U8 *buffer,
        S32 buffer_size,
        U8 *history_buffer)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    gui_lock_double_buffer();
    gui_setup_common_layout();
    wgui_inputbox_buffer_size = buffer_size;
    cat_215_fit_text_for_gb_length_in_multiline_inputbox(buffer);
    ShowCategory5Screen(
        title,
        title_icon,
        left_softkey,
        left_softkey_icon,
        right_softkey,
        right_softkey_icon,
        input_type,
        buffer,
        buffer_size,
        history_buffer);
    wgui_inputs_ml_register_change_event_handler(cat_215_ext_text_change_event_callback);
    wgui_inputs_ml_register_infobar_callback(
        cat_215_draw_infobar_callback,
        cat_215_text_total_characters_in_byte_callback,
        0);
    wgui_inputs_ml_redraw_input_information_bar();
    gui_unlock_double_buffer();
    gui_BLT_double_buffer(0, 0, UI_device_width - 1, UI_device_height - 1);
}

/* Cat_215 End */


/*Cat 415 Start */
static void cat415_display_callback(dm_coordinates *coordinate);
static UI_string_type cat415_tips_string;

#if defined(__MMI_MAINLCD_240X320__)
#define CAT415_TIPS_AREA_HEIGHT   (Get_CharHeightOfAllLang(LARGE_FONT) * 2 + 6)
#else
#define CAT415_TIPS_AREA_HEIGHT   (Get_CharHeightOfAllLang(MEDIUM_FONT) * 2 + 5)
#endif 


/*****************************************************************************
 * FUNCTION
 *  GetCategory415HistorySize
 * DESCRIPTION
 *  
 * PARAMETERS
 *  void
 * RETURNS
 *  
 *****************************************************************************/
S32 GetCategory415HistorySize(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    return (sizeof(multiline_inputbox_category_history));
}


/*****************************************************************************
 * FUNCTION
 *  GetCategory415History
 * DESCRIPTION
 *  Gets the history buffer for category5 screen
 * PARAMETERS
 *  history_buffer      [IN]        Is the buffer into which the history data is stored (pre-allocated)
 * RETURNS
 *  Pointer to the history buffer
 *****************************************************************************/
U8 *GetCategory415History(U8 *history_buffer)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    wgui_inputs_ml_get_category_history(MMI_CATEGORY415_ID, history_buffer);
    return (history_buffer);
}


/* For detail description, please refer to wgui_categories_inputs.h */
void ShowCategory415Screen(
        U16 title,
        U16 title_icon,
        U16 left_softkey,
        U16 left_softkey_icon,
        U16 right_softkey,
        U16 right_softkey_icon,
        U16 message,
        U32 input_type,
        U8 *buffer,
        S32 buffer_size,
        U8 *history_buffer)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    dm_data_struct dm_data;
    S32 inputbox_x, inputbox_y, inputbox_width, inputbox_height;
    
    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    gui_setup_common_layout();

    inputbox_x = 0;
    inputbox_y = (MMI_title_y + MMI_title_height + CAT415_TIPS_AREA_HEIGHT);
    inputbox_width = MMI_content_width;
    inputbox_height = MMI_content_height - CAT415_TIPS_AREA_HEIGHT;

#if(UI_DOUBLE_BUFFER_SUPPORT)
	gui_lock_double_buffer();
#endif 
    cat415_tips_string = (UI_string_type) get_string(message);
	wgui_title_set_menu_shortcut_number(-1);
    wgui_title_disable_menu_shortcut_display(MMI_TRUE);
	clear_category_screen_key_handlers();
	change_left_softkey(left_softkey, left_softkey_icon);
	change_right_softkey(right_softkey, right_softkey_icon);
	clear_left_softkey();
	clear_right_softkey();
	register_left_softkey_handler();
	register_right_softkey_handler();
	register_default_hide_softkeys();
	

	MMI_title_string = (UI_string_type) get_string(title);
	MMI_title_icon = (PU8) get_image(title_icon);
	wgui_inputs_ml_setup(
		inputbox_x,
		inputbox_y,
		inputbox_width,
		inputbox_height,
		buffer,
		buffer_size,
		MMI_CATEGORY415_ID,
		get_string(right_softkey),
		get_image(right_softkey_icon),
		input_type,
		history_buffer,
		1);

	if (((input_type & INPUT_TYPE_MASK) == IMM_INPUT_TYPE_NUMERIC_PASSWORD) ||
		((input_type & INPUT_TYPE_MASK) == IMM_INPUT_TYPE_ALPHANUMERIC_PASSWORD) ||
		((input_type & INPUT_TYPE_MASK) == IMM_INPUT_TYPE_SAT_NUMERIC_PASSWORD) ||
		((input_type & INPUT_TYPE_MASK) == IMM_INPUT_TYPE_SIGNED_DECIMAL_NUMERIC_PASSWORD) ||
		((input_type & INPUT_TYPE_MASK) == IMM_INPUT_TYPE_SIGNED_NUMERIC_PASSWORD))
	{
		MMI_current_input_ext_type |= INPUT_TYPE_EXT_NO_SHOW_NEW_LINE_SYMBOL;
	}
	
#if defined(__MMI_FULL_SCREEN_EDITOR__)
	inputbox_height = MMI_content_height - wgui_inputbox_information_bar_height;
#else 
	inputbox_height = MMI_content_height - MMI_multitap_height - wgui_inputbox_information_bar_height;
#endif 
	if (wgui_inputs_ml_get_height() > inputbox_height)
	{
	    wgui_inputs_ml_resize(WGUI_INPUTS_STYLE_DEFAULT, inputbox_height);
	}

    wgui_inputs_ml_set_common_style(MMI_TRUE, MMI_TRUE);
	
#ifdef __MMI_WALLPAPER_ON_BOTTOM__
	dm_get_scr_bg_opacity(&editor_scr_bg_opacity);
	dm_set_scr_bg_opacity((U8)(current_MMI_theme->bg_opacity_low));
#endif 
	
	gui_unlock_double_buffer();
	
	ExitCategoryFunction = ExitCategory415Screen;
	dm_data.s32flags = DM_CLEAR_SCREEN_BACKGROUND;
	dm_data.s32flags |= DM_SHOW_VKPAD;
	dm_setup_category_functions(dm_redraw_category_screen, GetCategory415History, GetCategory415HistorySize);
	dm_register_category_controlled_callback(cat415_display_callback);
	dm_data.s32ScrId = (S32) GetActiveScreenId();
	dm_data.s32CatId = MMI_CATEGORY415_ID;
	dm_setup_data(&dm_data);
	dm_register_vkpad_callback(mmi_imc_redraw_screen_by_state);
	dm_redraw_category_screen();
}


/*****************************************************************************
 * FUNCTION
 *  ExitCategory4155Screen
 * DESCRIPTION
 *  Exits the category415 screen
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void ExitCategory415Screen(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    wgui_inputs_ml_close();
    reset_softkeys();
    ExitCategoryFunction = MMI_dummy_function;
    RedrawCategoryFunction = MMI_dummy_function;
    GetCategoryHistory = dummy_get_history;
    GetCategoryHistorySize = dummy_get_history_size;
    wgui_check_editor_buffer_need_flush = NULL;
#ifdef __MMI_WALLPAPER_ON_BOTTOM__
    dm_set_scr_bg_opacity(editor_scr_bg_opacity);
#endif /* __MMI_WALLPAPER_ON_BOTTOM__ */ 

#ifdef UI_SMALL_LIST_SCREEN
    restore_small_screen();
#endif 
}


/*****************************************************************************
 * FUNCTION
 *  cat415_display_callback
 * DESCRIPTION
 *  
 * PARAMETERS
 *  coordinate      [?]     
 * RETURNS
 *  void
 *****************************************************************************/
void cat415_display_callback(dm_coordinates *coordinate)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    multi_line_input_box read_only_inputbox;
    S32 inputbox_x = 0;
    S32 inputbox_y = (MMI_title_y + MMI_title_height);
    S32 inputbox_width = MMI_content_width;
    S32 inputbox_height = CAT415_TIPS_AREA_HEIGHT;
    S32 len;
    
    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    len = gui_strlen(MMI_message_string);
    gui_create_multi_line_input_box_set_buffer(
        &read_only_inputbox,
        inputbox_x,
        inputbox_y,
        inputbox_width,
        inputbox_height,
        cat415_tips_string,
        len * 2,
        (len + 1) * 2,
        0);
    read_only_inputbox.normal_text_color = *current_MMI_theme->list_normal_text_color;
    read_only_inputbox.flags |=
            (UI_MULTI_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW | UI_MULTI_LINE_INPUT_BOX_DISABLE_BACKGROUND |
             UI_MULTI_LINE_INPUT_BOX_DISABLE_SCROLLBAR | UI_MULTI_LINE_INPUT_BOX_VIEW_MODE | UI_MULTI_LINE_INPUT_BOX_CENTER_JUSTIFY);
    read_only_inputbox.ext_flags |= GUI_MULTI_LINE_INPUT_BOX_TRUNCATE_CONTENT;

    /* show read only inputbox */
    gui_show_multi_line_input_box(&read_only_inputbox);

    /* show editor */
    gui_show_multi_line_input_box(&MMI_multiline_inputbox);

    /* redraw information bar */
    wgui_inputs_ml_redraw_input_information_bar();
    
}


/*****************************************************************************
 * FUNCTION
 *  SetCategory415RightSoftkeyFunction
 * DESCRIPTION
 *  set category 415 right softkey callback function
 * PARAMETERS
 *  f       [IN]        Callback function
 *  k       [IN]        Key event type
 * RETURNS
 *  void
 *****************************************************************************/
void SetCategory415RightSoftkeyFunction(void (*f) (void), MMI_key_event_type k)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    UI_UNUSED_PARAMETER(k);
    wgui_inputbox_RSK_function = f;
}


/*****************************************************************************
 * FUNCTION
 *  wgui_inputs_get_editor_handler
 * DESCRIPTION
 *  get editor hanlder;
 * PARAMETERS
 *  void
 * RETURNS
 *  mmi_editor_handler_struct
 *****************************************************************************/
mmi_editor_handler_struct* wgui_inputs_get_editor_handler(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    return &g_mmi_editor_hanler;
}
